3
<link rel="stylesheet" href="style.css" type="text/css">
4
<link rel="Start" href="index.html">
5
<link rel="previous" href="Mutex.html">
6
<link rel="next" href="Num.html">
7
<link rel="Up" href="index.html">
8
<link title="Index of types" rel="Appendix" href="index_types.html">
9
<link title="Index of exceptions" rel="Appendix" href="index_exceptions.html">
10
<link title="Index of values" rel="Appendix" href="index_values.html">
11
<link title="Index of class attributes" rel="Appendix" href="index_attributes.html">
12
<link title="Index of class methods" rel="Appendix" href="index_methods.html">
13
<link title="Index of classes" rel="Appendix" href="index_classes.html">
14
<link title="Index of class types" rel="Appendix" href="index_class_types.html">
15
<link title="Index of modules" rel="Appendix" href="index_modules.html">
16
<link title="Index of module types" rel="Appendix" href="index_module_types.html">
17
<link title="Arg" rel="Chapter" href="Arg.html">
19
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
21
<link title="Array" rel="Chapter" href="Array.html">
23
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
25
<link title="Big_int" rel="Chapter" href="Big_int.html">
27
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
29
<link title="Buffer" rel="Chapter" href="Buffer.html">
31
<link title="Callback" rel="Chapter" href="Callback.html">
33
<link title="Char" rel="Chapter" href="Char.html">
35
<link title="Condition" rel="Chapter" href="Condition.html">
37
<link title="Dbm" rel="Chapter" href="Dbm.html">
39
<link title="Digest" rel="Chapter" href="Digest.html">
41
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
43
<link title="Event" rel="Chapter" href="Event.html">
45
<link title="Filename" rel="Chapter" href="Filename.html">
47
<link title="Format" rel="Chapter" href="Format.html">
49
<link title="Gc" rel="Chapter" href="Gc.html">
51
<link title="Genlex" rel="Chapter" href="Genlex.html">
53
<link title="Graphics" rel="Chapter" href="Graphics.html">
55
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
57
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
59
<link title="Int32" rel="Chapter" href="Int32.html">
61
<link title="Int64" rel="Chapter" href="Int64.html">
63
<link title="Lazy" rel="Chapter" href="Lazy.html">
65
<link title="Lexing" rel="Chapter" href="Lexing.html">
67
<link title="List" rel="Chapter" href="List.html">
69
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
71
<link title="Map" rel="Chapter" href="Map.html">
73
<link title="Marshal" rel="Chapter" href="Marshal.html">
75
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
77
<link title="Mutex" rel="Chapter" href="Mutex.html">
79
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
81
<link title="Num" rel="Chapter" href="Num.html">
83
<link title="Obj" rel="Chapter" href="Obj.html">
85
<link title="Oo" rel="Chapter" href="Oo.html">
87
<link title="Parsing" rel="Chapter" href="Parsing.html">
89
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
91
<link title="Printexc" rel="Chapter" href="Printexc.html">
93
<link title="Printf" rel="Chapter" href="Printf.html">
95
<link title="Queue" rel="Chapter" href="Queue.html">
97
<link title="Random" rel="Chapter" href="Random.html">
99
<link title="Set" rel="Chapter" href="Set.html">
101
<link title="Sort" rel="Chapter" href="Sort.html">
103
<link title="Stack" rel="Chapter" href="Stack.html">
105
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
107
<link title="Str" rel="Chapter" href="Str.html">
109
<link title="Stream" rel="Chapter" href="Stream.html">
111
<link title="String" rel="Chapter" href="String.html">
113
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
115
<link title="Sys" rel="Chapter" href="Sys.html">
117
<link title="Thread" rel="Chapter" href="Thread.html">
119
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
121
<link title="Tk" rel="Chapter" href="Tk.html">
123
<link title="Unix" rel="Chapter" href="Unix.html">
125
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
127
<link title="Weak" rel="Chapter" href="Weak.html">
128
<title>Nativeint</title>
131
<div class="navbar"><a href="Mutex.html">Previous</a>
132
<a href="index.html">Up</a>
133
<a href="Num.html">Next</a>
135
<center><h1>Module <a href="type_Nativeint.html">Nativeint</a></h1></center>
137
<pre><span class="keyword">module</span> Nativeint = <code><span class="keyword">struct</span> ... <span class="keyword">end</span> </code></pre><div class="info">
138
Processor-native integers.<br>
139
This module provides operations on the type <code>nativeint</code> of
140
signed 32-bit integers (on 32-bit platforms) or
141
signed 64-bit integers (on 64-bit platforms).
142
This integer type has exactly the same width as that of a <code>long</code>
143
integer type in the C compiler. All arithmetic operations over
144
<code>nativeint</code> are taken modulo 2<sup class="superscript">32</sup> or 2<sup class="superscript">64</sup> depending
145
on the word size of the architecture.<br>
146
Performance notice: values of type <code>nativeint</code> occupy more memory
147
space than values of type <code>int</code>, and arithmetic operations on
148
<code>nativeint</code> are generally slower than those on <code>int</code>. Use <code>nativeint</code>
149
only when the application requires the extra bit of precision
150
over the <code>int</code> type.<br>
153
<pre><span class="keyword">val</span> <a name="VALzero"></a>zero : <code class="type">nativeint</code></pre><div class="info">
154
The native integer 0.<br>
156
<pre><span class="keyword">val</span> <a name="VALone"></a>one : <code class="type">nativeint</code></pre><div class="info">
157
The native integer 1.<br>
159
<pre><span class="keyword">val</span> <a name="VALminus_one"></a>minus_one : <code class="type">nativeint</code></pre><div class="info">
160
The native integer -1.<br>
162
<pre><span class="keyword">val</span> <a name="VALneg"></a>neg : <code class="type">nativeint -> nativeint</code></pre><div class="info">
165
<pre><span class="keyword">val</span> <a name="VALadd"></a>add : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
168
<pre><span class="keyword">val</span> <a name="VALsub"></a>sub : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
171
<pre><span class="keyword">val</span> <a name="VALmul"></a>mul : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
174
<pre><span class="keyword">val</span> <a name="VALdiv"></a>div : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
175
Integer division. Raise <code><span class="constructor">Division_by_zero</span></code> if the second
176
argument is zero.<br>
178
<pre><span class="keyword">val</span> <a name="VALrem"></a>rem : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
179
Integer remainder. If <code>x >= 0</code> and <code>y > 0</code>, the result
180
of <code><span class="constructor">Nativeint</span>.rem x y</code> satisfies the following properties:
181
<code>0 <= <span class="constructor">Nativeint</span>.rem x y < y</code> and
182
<code>x = <span class="constructor">Nativeint</span>.add (<span class="constructor">Nativeint</span>.mul (<span class="constructor">Nativeint</span>.div x y) y) (<span class="constructor">Nativeint</span>.rem x y)</code>.
183
If <code>y = 0</code>, <code><span class="constructor">Nativeint</span>.rem x y</code> raises <code><span class="constructor">Division_by_zero</span></code>.
184
If <code>x < 0</code> or <code>y < 0</code>, the result of <code><span class="constructor">Nativeint</span>.rem x y</code> is
185
not specified and depends on the platform.<br>
187
<pre><span class="keyword">val</span> <a name="VALsucc"></a>succ : <code class="type">nativeint -> nativeint</code></pre><div class="info">
189
<code><span class="constructor">Nativeint</span>.succ x</code> is <code><span class="constructor">Nativeint</span>.add x <span class="constructor">Nativeint</span>.one</code>.<br>
191
<pre><span class="keyword">val</span> <a name="VALpred"></a>pred : <code class="type">nativeint -> nativeint</code></pre><div class="info">
193
<code><span class="constructor">Nativeint</span>.pred x</code> is <code><span class="constructor">Nativeint</span>.sub x <span class="constructor">Nativeint</span>.one</code>.<br>
195
<pre><span class="keyword">val</span> <a name="VALabs"></a>abs : <code class="type">nativeint -> nativeint</code></pre><div class="info">
196
Return the absolute value of its argument.<br>
198
<pre><span class="keyword">val</span> <a name="VALsize"></a>size : <code class="type">int</code></pre><div class="info">
199
The size in bits of a native integer. This is equal to <code>32</code>
200
on a 32-bit platform and to <code>64</code> on a 64-bit platform.<br>
202
<pre><span class="keyword">val</span> <a name="VALmax_int"></a>max_int : <code class="type">nativeint</code></pre><div class="info">
203
The greatest representable native integer,
204
either 2<sup class="superscript">31</sup> - 1 on a 32-bit platform,
205
or 2<sup class="superscript">63</sup> - 1 on a 64-bit platform.<br>
207
<pre><span class="keyword">val</span> <a name="VALmin_int"></a>min_int : <code class="type">nativeint</code></pre><div class="info">
208
The greatest representable native integer,
209
either -2<sup class="superscript">31</sup> on a 32-bit platform,
210
or -2<sup class="superscript">63</sup> on a 64-bit platform.<br>
212
<pre><span class="keyword">val</span> <a name="VALlogand"></a>logand : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
213
Bitwise logical and.<br>
215
<pre><span class="keyword">val</span> <a name="VALlogor"></a>logor : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
216
Bitwise logical or.<br>
218
<pre><span class="keyword">val</span> <a name="VALlogxor"></a>logxor : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
219
Bitwise logical exclusive or.<br>
221
<pre><span class="keyword">val</span> <a name="VALlognot"></a>lognot : <code class="type">nativeint -> nativeint</code></pre><div class="info">
222
Bitwise logical negation<br>
224
<pre><span class="keyword">val</span> <a name="VALshift_left"></a>shift_left : <code class="type">nativeint -> int -> nativeint</code></pre><div class="info">
225
<code><span class="constructor">Nativeint</span>.shift_left x y</code> shifts <code>x</code> to the left by <code>y</code> bits.
226
The result is unspecified if <code>y < 0</code> or <code>y >= bitsize</code>,
227
where <code>bitsize</code> is <code>32</code> on a 32-bit platform and
228
<code>64</code> on a 64-bit platform.<br>
230
<pre><span class="keyword">val</span> <a name="VALshift_right"></a>shift_right : <code class="type">nativeint -> int -> nativeint</code></pre><div class="info">
231
<code><span class="constructor">Nativeint</span>.shift_right x y</code> shifts <code>x</code> to the right by <code>y</code> bits.
232
This is an arithmetic shift: the sign bit of <code>x</code> is replicated
233
and inserted in the vacated bits.
234
The result is unspecified if <code>y < 0</code> or <code>y >= bitsize</code>.<br>
236
<pre><span class="keyword">val</span> <a name="VALshift_right_logical"></a>shift_right_logical : <code class="type">nativeint -> int -> nativeint</code></pre><div class="info">
237
<code><span class="constructor">Nativeint</span>.shift_right_logical x y</code> shifts <code>x</code> to the right
238
by <code>y</code> bits.
239
This is a logical shift: zeroes are inserted in the vacated bits
240
regardless of the sign of <code>x</code>.
241
The result is unspecified if <code>y < 0</code> or <code>y >= bitsize</code>.<br>
243
<pre><span class="keyword">val</span> <a name="VALof_int"></a>of_int : <code class="type">int -> nativeint</code></pre><div class="info">
244
Convert the given integer (type <code>int</code>) to a native integer
245
(type <code>nativeint</code>).<br>
247
<pre><span class="keyword">val</span> <a name="VALto_int"></a>to_int : <code class="type">nativeint -> int</code></pre><div class="info">
248
Convert the given native integer (type <code>nativeint</code>) to an
249
integer (type <code>int</code>). The high-order bit is lost during
252
<pre><span class="keyword">val</span> <a name="VALof_float"></a>of_float : <code class="type">float -> nativeint</code></pre><div class="info">
253
Convert the given floating-point number to a native integer,
254
discarding the fractional part (truncate towards 0).
255
The result of the conversion is undefined if, after truncation,
256
the number is outside the range
257
[<a href="Nativeint.html#VALmin_int"><code><span class="constructor">Nativeint</span>.min_int</code></a>, <a href="Nativeint.html#VALmax_int"><code><span class="constructor">Nativeint</span>.max_int</code></a>].<br>
259
<pre><span class="keyword">val</span> <a name="VALto_float"></a>to_float : <code class="type">nativeint -> float</code></pre><div class="info">
260
Convert the given native integer to a floating-point number.<br>
262
<pre><span class="keyword">val</span> <a name="VALof_int32"></a>of_int32 : <code class="type">int32 -> nativeint</code></pre><div class="info">
263
Convert the given 32-bit integer (type <code>int32</code>)
264
to a native integer.<br>
266
<pre><span class="keyword">val</span> <a name="VALto_int32"></a>to_int32 : <code class="type">nativeint -> int32</code></pre><div class="info">
267
Convert the given native integer to a
268
32-bit integer (type <code>int32</code>). On 64-bit platforms,
269
the 64-bit native integer is taken modulo 2<sup class="superscript">32</sup>,
270
i.e. the top 32 bits are lost. On 32-bit platforms,
271
the conversion is exact.<br>
273
<pre><span class="keyword">val</span> <a name="VALof_string"></a>of_string : <code class="type">string -> nativeint</code></pre><div class="info">
274
Convert the given string to a native integer.
275
The string is read in decimal (by default) or in hexadecimal,
276
octal or binary if the string begins with <code>0x</code>, <code>0o</code> or <code>0b</code>
278
Raise <code><span class="constructor">Failure</span> <span class="string">"int_of_string"</span></code> if the given string is not
279
a valid representation of an integer.<br>
281
<pre><span class="keyword">val</span> <a name="VALto_string"></a>to_string : <code class="type">nativeint -> string</code></pre><div class="info">
282
Return the string representation of its argument, in decimal.<br>
284
<pre><span class="keyword">val</span> <a name="VALformat"></a>format : <code class="type">string -> nativeint -> string</code></pre><div class="info">
285
<code><span class="constructor">Nativeint</span>.format fmt n</code> return the string representation of the
286
native integer <code>n</code> in the format specified by <code>fmt</code>.
287
<code>fmt</code> is a <code><span class="constructor">Printf</span></code>-style format containing exactly
288
one <code>%d</code>, <code>%i</code>, <code>%u</code>, <code>%x</code>, <code>%<span class="constructor">X</span></code> or <code>%o</code> conversion specification.
289
This function is deprecated; use <a href="Printf.html#VALsprintf"><code><span class="constructor">Printf</span>.sprintf</code></a> with a <code>%nx</code> format
b'\\ No newline at end of file'