Module Stdlib_upstream_compatible.Nativeint_uSource
Unboxed processor-native integers. This file primarily duplicates functionality from the Nativeint module, but for nativeint#.
This module provides operations on the type nativeint# of unboxed signed 32-bit integers (on 32-bit platforms) or unboxed signed 64-bit integers (on 64-bit platforms). This integer type has exactly the same width as that of a pointer type in the C compiler. All arithmetic operations over nativeint# are wrapping, not truncating.
An alias for the type of unboxed native integers.
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 unboxed native integers.
Integer remainder. If y is not zero, the result of Nativeint_u.rem x y satisfies the following properties: Nativeint_u.zero <= Nativeint_u.rem x y < Nativeint_u.abs y and x = Nativeint_u.add (Nativeint_u.mul (Nativeint_u.div x y) y) (Nativeint_u.rem x y). If y = 0, Nativeint_u.rem x y raises Division_by_zero.
Same as rem, except that arguments and result are interpreted as unsigned unboxed native integers.
Successor. Nativeint_u.succ x is Nativeint_u.add x Nativeint_u.one.
Predecessor. Nativeint_u.pred x is Nativeint_u.sub x Nativeint_u.one.
The size in bits of an unboxed native integer. This is equal to 32 on a 32-bit platform and to 64 on a 64-bit platform.
Nativeint_u.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is #32 on a 32-bit platform and #64 on a 64-bit platform.
Nativeint_u.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.
Nativeint_u.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.
Convert the given integer (type int) to an unboxed native integer (type nativeint#).
Convert the given unboxed native integer (type nativeint#) to an integer (type int). The high-order bit is lost during the conversion.
Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.
Convert the given floating-point number to an unboxed native integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Nativeint_u.min_int, Nativeint_u.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.
Convert the given unboxed native integer to a floating-point number.
Convert the given 32-bit integer (type int32) to an unboxed native integer.
Convert the given unboxed native integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit unboxed native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.
Convert the given unboxed 32-bit integer (type int32) to an unboxed native integer.
Convert the given unboxed native integer to an unboxed 32-bit integer (type int32). On 64-bit platforms, the 64-bit unboxed native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.
Convert the given string to an unboxed native 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*Nativeint_u.max_int+1]. If the input exceeds Nativeint_u.max_int it is converted to the signed integer Int64.min_int + input - Nativeint_u.max_int - 1.
Return the string representation of its argument, in decimal.
The comparison function for unboxed native integers, with the same specification as Stdlib.compare.
Same as compare, except that arguments are interpreted as unsigned unboxed native integers.