Module Flambda2_numbers.Target_ocaml_int
Operations using the semantics of the OCaml type "int" on the target machine. That is to say, 31-bit arithmetic on 32-bit targets; and 63-bit arithmetic on 64-bit targets.
include Flambda2_algorithms.Container_types.S
with type t := Flambda2_numbers.Target_ocaml_int.t
module T :
Flambda2_algorithms.Container_types_intf.Thing
with type t = Flambda2_numbers.Target_ocaml_int.tinclude Flambda2_algorithms.Container_types_intf.Thing
with type t := Flambda2_numbers.Target_ocaml_int.T.t
include Stdlib.Hashtbl.HashedType
with type t := Flambda2_numbers.Target_ocaml_int.T.t
val equal :
Flambda2_numbers.Target_ocaml_int.T.t ->
Flambda2_numbers.Target_ocaml_int.T.t ->
boolThe equality predicate used to compare keys.
val hash : Flambda2_numbers.Target_ocaml_int.T.t -> intA hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include
- (
(=),hash) for comparing objects by structure (provided objects do not contain floats) - (
(fun x y -> compare x y = 0),hash) for comparing objects by structure and handlingStdlib.nancorrectly - (
(==),hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Stdlib.Map.OrderedType
with type t := Flambda2_numbers.Target_ocaml_int.T.t
val compare :
Flambda2_numbers.Target_ocaml_int.T.t ->
Flambda2_numbers.Target_ocaml_int.T.t ->
intA total ordering function over the keys. This is a two-argument function f such that f e1 e2 is zero if the keys e1 and e2 are equal, f e1 e2 is strictly negative if e1 is smaller than e2, and f e1 e2 is strictly positive if e1 is greater than e2. Example: a suitable ordering function is the generic structural comparison function Stdlib.compare.
val print :
Stdlib.Format.formatter ->
Flambda2_numbers.Target_ocaml_int.T.t ->
unitmodule Set :
Flambda2_algorithms.Container_types_intf.Set
with type elt = Flambda2_numbers.Target_ocaml_int.tmodule Map :
Flambda2_algorithms.Container_types_intf.Map
with type key = Flambda2_numbers.Target_ocaml_int.t
and module Set = Flambda2_numbers.Target_ocaml_int.Setval machine_width :
Flambda2_numbers.Target_ocaml_int.t ->
Target_system.Machine_width.tval min_value :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.tThe minimum integer representable on the target.
val max_value :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.tThe maximum integer representable on the target.
val minus_one :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.tThe OCaml integer -1
The OCaml integer 0.
The OCaml integer 1.
The OCaml integer 10.
val hex_ff :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.tThe OCaml integer 0xff.
val zero_one_and_minus_one :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.Set.tThe set
1, 0, 1
}
.
val bool :
Target_system.Machine_width.t ->
bool ->
Flambda2_numbers.Target_ocaml_int.tBoolean values.
val bool_true :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.tval bool_false :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.tval all_bools :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.Set.tval (<=) :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
boolComparison functions.
val (>=) :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
boolval (<) :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
boolval bottom_byte_to_int : Flambda2_numbers.Target_ocaml_int.t -> intReturns the 8 least significant bits of the OCaml integer as a host caml integer (cannot overflow).
val of_char :
Target_system.Machine_width.t ->
char ->
Flambda2_numbers.Target_ocaml_int.tReturns the OCaml integer corresponding to the ASCII code of the given character.
val of_int :
Target_system.Machine_width.t ->
int ->
Flambda2_numbers.Target_ocaml_int.tConvert the given integer (type int) to a OCaml integer (type t), modulo the target word size minus one (for the tag bit).
val of_int_option :
Target_system.Machine_width.t ->
int ->
Flambda2_numbers.Target_ocaml_int.t optionReturns None iff the given int cannot be represented as a target "int"-width integer, else returns the same as of_int.
val to_int : Flambda2_numbers.Target_ocaml_int.t -> intConvert the given OCaml integer (type t) to an integer (type int), modulo the int size, i.e. high-order bits are lost during the conversion.
val to_int_option : Flambda2_numbers.Target_ocaml_int.t -> int optionConvert the given OCaml integer (type t) to an integer (type int). Returns None if the original OCaml integer does not fit into an integer
val to_int_exn : Flambda2_numbers.Target_ocaml_int.t -> intConvert the given OCaml integer (type t) to an integer (type int).
val of_int32 :
Target_system.Machine_width.t ->
int32 ->
Flambda2_numbers.Target_ocaml_int.tConvert the given 32-bit integer (type int32) to a OCaml integer, modulo the size of a OCaml integer.
val to_int32 : Flambda2_numbers.Target_ocaml_int.t -> int32Convert the given OCaml integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.
val of_int64 :
Target_system.Machine_width.t ->
int64 ->
Flambda2_numbers.Target_ocaml_int.tConvert the given 64-bit integer (type int64) to a target native integer, modulo the size of a OCaml integer.
val to_int64 : Flambda2_numbers.Target_ocaml_int.t -> int64Convert the given OCaml integer to a 64-bit integer (type int64).
val of_targetint :
Target_system.Machine_width.t ->
Flambda2_numbers.Targetint_32_64.t ->
Flambda2_numbers.Target_ocaml_int.tConvert the given target native integer (type Targetint_32_64.t) to an OCaml integer, modulo the size of an OCaml integer.
val to_targetint :
Target_system.Machine_width.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Targetint_32_64.tConvert the given OCaml integer (type t) to a target native integer (type Targetint_32_64.t).
val of_float :
Target_system.Machine_width.t ->
float ->
Flambda2_numbers.Target_ocaml_int.tConvert the given floating-point number to an OCaml integer, discarding the fractional part (truncate towards 0). The result of the conversion is undefined if, after truncation, the number is outside the range [Targetint_31_63.min_value, Targetint_31_63.max_value].
val to_float : Flambda2_numbers.Target_ocaml_int.t -> floatConvert the given OCaml integer to a floating-point number.
Unary negation.
val get_least_significant_16_bits_then_byte_swap :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tExtract the least significant 16 bits from the given OCaml integer, exchange the order of the two bytes extracted, then form a new target integer by zero-extending those two bytes.
val add :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tAddition.
val sub :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tSubtraction.
val mul :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tMultiplication.
val div :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tInteger division and modulo. Raise Division_by_zero if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).
val and_ :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tBitwise logical and.
val or_ :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tBitwise logical or.
val xor :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tBitwise logical exclusive or.
val shift_left :
Flambda2_numbers.Target_ocaml_int.t ->
int ->
Flambda2_numbers.Target_ocaml_int.tshift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 31 on a 32-bit platform and 63 on a 64-bit platform.
val shift_right :
Flambda2_numbers.Target_ocaml_int.t ->
int ->
Flambda2_numbers.Target_ocaml_int.tTargetint_32_64.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.
val shift_right_logical :
Flambda2_numbers.Target_ocaml_int.t ->
int ->
Flambda2_numbers.Target_ocaml_int.tTargetint_32_64.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.
val min :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tReturns the smaller integer.
val max :
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_numbers.Target_ocaml_int.tReturns the larger integer.
val is_non_negative : Flambda2_numbers.Target_ocaml_int.t -> boolmodule Pair : sig ... end