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