Unsigned.UInt64
Unsigned 64-bit integer type and operations.
include S
Division. Raise Division_by_zero
if the second argument is zero.
Integer remainder. Raise Division_by_zero
if the second argument is zero.
val max_int : t
The greatest representable integer.
shift_left
x
y
shifts x
to the left by y
bits.
shift_right
x
y
shifts x
to the right by y
bits.
val of_int : int -> t
Convert the given int value to an unsigned integer.
val to_int : t -> int
Convert the given unsigned integer value to an int.
val of_string : string -> t
Convert the given string to an unsigned integer. Raise Failure
if the given string is not a valid representation of an unsigned integer.
val to_string : t -> string
Return the string representation of its argument.
val to_hexstring : t -> string
Return the hexadecimal string representation of its argument.
val zero : t
The integer 0.
val one : t
The integer 1.
The comparison function for unsigned integers, with the same specification as Stdlib.compare
.
Tests for equality, with the same specification as Stdlib.(=)
.
val of_string_opt : string -> t option
Convert the given string to an unsigned integer. Returns None
if the given string is not a valid representation of an unsigned integer.
val pp : Format.formatter -> t -> unit
Output the result of to_string
on a formatter.
val pp_hex : Format.formatter -> t -> unit
Output the result of to_hexstring
on a formatter.
val of_int64 : int64 -> t
Convert the given 64-bit signed integer to an unsigned 64-bit integer.
If the signed integer fits within the unsigned range (in other words, if the signed integer is positive) then the numerical values represented by the signed and unsigned integers are the same.
Whether the signed integer fits or not, the function of_int64
is always the inverse of the function to_int64
. In other words, to_int64 (of_int64 x) = x
holds for all x : int64
.
val to_int64 : t -> int64
Convert the given 64-bit unsigned integer to a signed 64-bit integer.
If the unsigned integer fits within the signed range (in other words, if the unsigned integer is less than Int64.max_int
) then the numerical values represented by unsigned and signed integers are the same.
Whether the unsigned integer fits or not, the function to_int64
is always the inverse of the function of_int64
. In other words, of_int64 (to_int64 x) = x
holds for all x : t
.
Convert the given 32-bit unsigned integer to a 64-bit unsigned integer.