Module Base__.Nativeint
include Base__.Int_intf.S with type t = nativeint
module O : sig ... endA sub-module designed to be opened to make working with ints more convenient.
val is_pow2 : t -> boolis_pow2 xreturns true iffxis a power of 2.is_pow2raises ifx <= 0.
val floor_log2 : t -> intfloor_log2 xreturns the floor of log-base-2 ofx, and raises ifx <= 0.
val ceil_log2 : t -> intceil_log2 xreturns the ceiling of log-base-2 ofx, and raises ifx <= 0.
val floor_pow2 : t -> tfloor_pow2 xreturns the largest power of 2 that is less than or equal tox. The implementation may only be called forx > 0. Example:floor_pow2 17 = 16
val ceil_pow2 : t -> tceil_pow2 xreturns the smallest power of 2 that is greater than or equal tox. The implementation may only be called forx > 0. Example:ceil_pow2 17 = 32
val shift_right_logical : t -> int -> tShifts right, filling in with zeroes, which will not preserve the sign of the input.
val min_value : tThe smallest representable integer.
val max_value : tThe largest representable integer.
val num_bits : intThe number of bits available in this integer type. Note that the integer representations are signed.
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_valueval t_of_sexp : Base.Sexp.t -> tval sexp_of_t : t -> Base.Sexp.t
include Base.Floatable.S with type t := t
include Base.Intable.S with type t := t
include Base.Identifiable.S with type t := t
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_valueval t_of_sexp : Base.Sexp.t -> tval sexp_of_t : t -> Base.Sexp.tval of_string : string -> tval to_string : t -> stringval (>=) : t -> t -> boolval (<=) : t -> t -> boolval (=) : t -> t -> boolval (>) : t -> t -> boolval (<) : t -> t -> boolval (<>) : t -> t -> boolval equal : t -> t -> boolval compare : t -> t -> intval min : t -> t -> tval max : t -> t -> tval ascending : t -> t -> intval descending : t -> t -> intval between : t -> low:t -> high:t -> boolval clamp_exn : t -> min:t -> max:t -> tval clamp : t -> min:t -> max:t -> t Base.Or_error.t
val comparator : (t, comparator_witness) Base.Comparator.comparatorval validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.checkval pp : Base.Formatter.t -> t -> unit
include Base.Comparable.With_zero with type t := t
val validate_positive : t Base.Validate.checkval validate_non_negative : t Base.Validate.checkval validate_negative : t Base.Validate.checkval validate_non_positive : t Base.Validate.checkval is_positive : t -> boolval is_non_negative : t -> boolval is_negative : t -> boolval is_non_positive : t -> boolval sign : t -> Base__.Sign0.t
include Base__.Int_intf.Hexable with type t := t
module Hex : sig ... endval to_string_hum : ?delimiter:char -> t -> stringdelimiteris an underscore by default.
Infix operators and constants
val zero : tval one : tval minus_one : tval (+) : t -> t -> tval (-) : t -> t -> tval (*) : t -> t -> tval (**) : t -> t -> tInteger exponentiation
Other common functions
include Base__.Int_intf.Round with type t := t
Successor and predecessor functions
Exponentiation
Bit-wise logical operations
Bit-shifting operations
The results are unspecified for negative shifts and shifts >= num_bits.
Increment and decrement functions for integer references
Conversion functions to related integer types
val of_int32_exn : int32 -> tval to_int32_exn : t -> int32val of_int64_exn : int64 -> tval to_int64 : t -> int64val of_nativeint_exn : nativeint -> tval to_nativeint_exn : t -> nativeintval of_float_unchecked : float -> tof_float_uncheckedtruncates the given floating point number to an integer, rounding towards zero. The result is unspecified if the argument is nan or falls outside the range of representable integers.
Conversion functions
val of_int : int -> tval to_int : t -> int optionval of_int32 : int32 -> tval to_int32 : t -> int32 optionval of_nativeint : nativeint -> tval to_nativeint : t -> nativeintval of_int64 : int64 -> t option
Truncating conversions
These functions return the least-significant bits of the input. In cases where optional conversions return Some x, truncating conversions return x.