1Stdlib.Nativeint(3)              OCaml library             Stdlib.Nativeint(3)
2
3
4

NAME

6       Stdlib.Nativeint - no description
7

Module

9       Module   Stdlib.Nativeint
10

Documentation

12       Module Nativeint
13        : (module Stdlib__nativeint)
14
15
16
17
18
19
20
21
22       val zero : nativeint
23
24       The native integer 0.
25
26
27
28       val one : nativeint
29
30       The native integer 1.
31
32
33
34       val minus_one : nativeint
35
36       The native integer -1.
37
38
39
40       val neg : nativeint -> nativeint
41
42       Unary negation.
43
44
45
46       val add : nativeint -> nativeint -> nativeint
47
48       Addition.
49
50
51
52       val sub : nativeint -> nativeint -> nativeint
53
54       Subtraction.
55
56
57
58       val mul : nativeint -> nativeint -> nativeint
59
60       Multiplication.
61
62
63
64       val div : nativeint -> nativeint -> nativeint
65
66       Integer  division.   Raise  Division_by_zero  if the second argument is
67       zero.  This division rounds the real quotient of its arguments  towards
68       zero, as specified for (/) .
69
70
71
72       val unsigned_div : nativeint -> nativeint -> nativeint
73
74       Same  as  Nativeint.div  ,  except that arguments and result are inter‐
75       preted as     unsigned native integers.
76
77
78       Since 4.08.0
79
80
81
82       val rem : nativeint -> nativeint -> nativeint
83
84       Integer remainder.  If y is not zero, the result of Nativeint.rem  x  y
85       satisfies the following properties: Nativeint.zero <= Nativeint.rem x y
86       < Nativeint.abs y and x = Nativeint.add (Nativeint.mul (Nativeint.div x
87       y)  y) (Nativeint.rem x y) .  If y = 0 , Nativeint.rem x y raises Divi‐
88       sion_by_zero .
89
90
91
92       val unsigned_rem : nativeint -> nativeint -> nativeint
93
94       Same as Nativeint.rem , except that arguments  and  result  are  inter‐
95       preted as     unsigned native integers.
96
97
98       Since 4.08.0
99
100
101
102       val succ : nativeint -> nativeint
103
104       Successor.  Nativeint.succ x is Nativeint.add x Nativeint.one .
105
106
107
108       val pred : nativeint -> nativeint
109
110       Predecessor.  Nativeint.pred x is Nativeint.sub x Nativeint.one .
111
112
113
114       val abs : nativeint -> nativeint
115
116       Return the absolute value of its argument.
117
118
119
120       val size : int
121
122       The  size in bits of a native integer.  This is equal to 32 on a 32-bit
123       platform and to 64 on a 64-bit platform.
124
125
126
127       val max_int : nativeint
128
129       The greatest representable native integer, either 2^31 - 1 on a  32-bit
130       platform, or 2^63 - 1 on a 64-bit platform.
131
132
133
134       val min_int : nativeint
135
136       The  smallest  representable  native  integer, either -2^31 on a 32-bit
137       platform, or -2^63 on a 64-bit platform.
138
139
140
141       val logand : nativeint -> nativeint -> nativeint
142
143       Bitwise logical and.
144
145
146
147       val logor : nativeint -> nativeint -> nativeint
148
149       Bitwise logical or.
150
151
152
153       val logxor : nativeint -> nativeint -> nativeint
154
155       Bitwise logical exclusive or.
156
157
158
159       val lognot : nativeint -> nativeint
160
161       Bitwise logical negation.
162
163
164
165       val shift_left : nativeint -> int -> nativeint
166
167
168       Nativeint.shift_left x y shifts x to the left by y bits.  The result is
169       unspecified  if y < 0 or y >= bitsize , where bitsize is 32 on a 32-bit
170       platform and 64 on a 64-bit platform.
171
172
173
174       val shift_right : nativeint -> int -> nativeint
175
176
177       Nativeint.shift_right x y shifts x to the right by y bits.  This is  an
178       arithmetic  shift:  the sign bit of x is replicated and inserted in the
179       vacated bits.  The result is unspecified if y < 0 or y >= bitsize .
180
181
182
183       val shift_right_logical : nativeint -> int -> nativeint
184
185
186       Nativeint.shift_right_logical x y shifts x to  the  right  by  y  bits.
187       This  is  a  logical  shift:  zeroes  are  inserted in the vacated bits
188       regardless of the sign of x .  The result is unspecified if y < 0 or  y
189       >= bitsize .
190
191
192
193       val of_int : int -> nativeint
194
195       Convert  the  given  integer  (type  int  )  to  a native integer (type
196       nativeint ).
197
198
199
200       val to_int : nativeint -> int
201
202       Convert the given native integer (type nativeint ) to an integer  (type
203       int ).  The high-order bit is lost during the conversion.
204
205
206
207       val unsigned_to_int : nativeint -> int option
208
209       Same  as  Nativeint.to_int , but interprets the argument as an unsigned
210       integer.  Returns None if the unsigned value of the argument cannot fit
211       into an int .
212
213
214       Since 4.08.0
215
216
217
218       val of_float : float -> nativeint
219
220       Convert the given floating-point number to a native integer, discarding
221       the fractional part (truncate towards 0).  The result of the conversion
222       is  undefined  if,  after truncation, the number is outside the range [
223       Nativeint.min_int , Nativeint.max_int ].
224
225
226
227       val to_float : nativeint -> float
228
229       Convert the given native integer to a floating-point number.
230
231
232
233       val of_int32 : int32 -> nativeint
234
235       Convert the given 32-bit integer (type int32 ) to a native integer.
236
237
238
239       val to_int32 : nativeint -> int32
240
241       Convert the given native integer to a 32-bit integer (type int32 ).  On
242       64-bit  platforms, the 64-bit native integer is taken modulo 2^32, i.e.
243       the top 32 bits are lost.   On  32-bit  platforms,  the  conversion  is
244       exact.
245
246
247
248       val of_string : string -> nativeint
249
250       Convert  the  given  string to a native integer.  The string is read in
251       decimal (by default, or if the string begins with 0u ) or in  hexadeci‐
252       mal,  octal  or  binary if the string begins with 0x , 0o or 0b respec‐
253       tively.
254
255       The 0u prefix reads the input as an unsigned integer in the  range  [0,
256       2*Nativeint.max_int+1]  .  If the input exceeds Nativeint.max_int it is
257       converted   to   the   signed   integer   Int64.min_int   +   input   -
258       Nativeint.max_int - 1 .
259
260       Raise  Failure  Nativeint.of_string  if the given string is not a valid
261       representation of an integer, or if the integer represented exceeds the
262       range of integers representable in type nativeint .
263
264
265
266       val of_string_opt : string -> nativeint option
267
268       Same as of_string , but return None instead of raising.
269
270
271       Since 4.05
272
273
274
275       val to_string : nativeint -> string
276
277       Return the string representation of its argument, in decimal.
278
279
280       type t = nativeint
281
282
283       An alias for the type of native integers.
284
285
286
287       val compare : t -> t -> int
288
289       The  comparison  function for native integers, with the same specifica‐
290       tion as compare .  Along with the type t , this function compare allows
291       the  module Nativeint to be passed as argument to the functors Set.Make
292       and Map.Make .
293
294
295
296       val unsigned_compare : t -> t -> int
297
298       Same as Nativeint.compare , except that arguments  are  interpreted  as
299       unsigned native integers.
300
301
302       Since 4.08.0
303
304
305
306       val equal : t -> t -> bool
307
308       The equal function for native ints.
309
310
311       Since 4.03.0
312
313
314
315
316
317OCamldoc                          2019-07-30               Stdlib.Nativeint(3)
Impressum