Module Stdlib_stable.Int8_uSource
Signed 8-bit integer values.
These integers are
bits wide and use two's complement representation. All operations are taken modulo 28. They do not fail on overflow.
8-bit Integers
The type for 8-bit integer values.
The number of bits in an integer of type int8#.
The 8-bit integer 0.
The 8-bit integer 1.
The 8-bit 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
to_int x is x as an int.
of_int x truncates the representation of x to fit in int8#.
untag a tagged int8
tag a naked int8
Same as to_int, but interprets the argument as an unsigned integer.
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 8-bit 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*Int8.max_int+1]. If the input exceeds Int8.max_int it is converted to the signed integer Int8.min_int + input - Int8.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.