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