Module Stdlib_stable.Int_uSource
Signed integer values.
These integers are Sys.int_size bits wide and use two's complement representation. All operations are taken modulo 2Sys.int_size. They do not fail on overflow.
Integers
The type for integer values without a tag bit.
The number of bits in an integer of type int#.
The integer 0.
The integer 1.
The integer -1.
Unary negation.
Addition.
Subtraction.
Multiplication.
Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).
Same as div, except that arguments and result are interpreted as unsigned integers.
Integer remainder. If y is not zero, rem x y = sub x (mul (div x y) y). If y is zero, rem x y raises Division_by_zero.
Same as rem, except that arguments and result are interpreted as unsigned integers.
succ x is add x 1.
pred x is sub x 1.
abs x is the absolute value of x. That is x if x is positive and neg x if x is negative. Warning. This may be negative if the argument is min_int.
max_int is the greatest representable integer, 2{^[size - 1]} - 1.
min_int is the smallest representable integer, -2{^[size - 1]}.
Bitwise logical and.
Bitwise logical or.
Bitwise logical exclusive or.
Bitwise logical negation.
shift_left x n shifts x to the left by n bits. The result is unspecified if n < 0 or n >= size.
shift_right x n shifts x to the right by n bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if n < 0 or n >=size.
shift_right x n shifts x to the right by n bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if n < 0 or n >=size.
Predicates and comparisons
equal x y is true if and only if x = y.
compare x y is Stdlib.compare x y but more efficient.
Same as compare, except that arguments are interpreted as unsigned integers.
Return the lesser of the two arguments.
Return the greater of the two arguments.
Converting
of_int x untags x without changing its value
to_int t tags x without changing its value
Same as to_int, but returns None if the value is not positive.
to_float x is x as a floating point number.
of_float x truncates x to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.
to_string x is the written representation of x in decimal.
Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.
The 0u prefix reads the input as an unsigned integer in the range [0, 2*Int.max_int+1]. If the input exceeds Int.max_int it is converted to the signed integer Int.min_int + input - Int.max_int - 1.
The _ (underscore) character can appear anywhere in the string and is ignored.
A seeded hash function for ints, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.
An unseeded hash function for ints, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.