package checked_oint

  1. Overview
  2. Docs

Module Checked_oint.I128Source

The implementation of i128.

include S with type t = i128
Sourcetype t = i128

The particular integer type.

The bitwise operations bit_not, bit_or, bit_and, bit_xor, shift_left, and shift_right assume that signed integers are represented in the two's complement notation.

NOTE: implementations may not support polymorphic comparison operators. Use equal and compare instead.

Sourceval compare : t -> t -> Ppx_deriving_runtime.int
Sourceval bits : int

The number of bits of this integer type.

Sourceval int_ty : int_ty

The type representation.

Sourceval zero : t

The value of 0.

Sourceval one : t

The value of 1.

Sourceval all_ones : t

The value that has all bits set to 1.

Sourceval min_int : t

The minimum value of this type.

Sourceval max_int : t

The maximum value of this type.

Sourceval is_signed : bool

Whether this integer type is signed or not.

Sourceval of_int : int -> t option

Constructs a value out of int; returns None on overflow/underflow.

Sourceval of_string : string -> t option

Constructs a value out of string; returns None on overflow/underflow.

We allow the following classes of non-negative integers:

  • Binary: 0b (0B) followed by a non-empty sequence of binary digits 0 and 1.
  • Octal: 0o (0O) followed by a non-empty sequence of octal digits 0, ..., 7.
  • Decimal: a non-empty sequence of decimal digits 0, ..., 9.
  • Hexadecimal: 0x (0X) followed by a non-empty sequence of decimal digits 0, ..., 9 and letters a, ..., f (A, ..., F).

A negative integer is described by the - character followed by a well-formed non-negative integer.

All other combinations of characters will return None.

Sourceval succ : t -> t option

Finds a successor; returns None on overflow.

Sourceval pred : t -> t option

Finds a predecessor; returns None on underflow.

Sourceval neg : t -> t option

Performs unary negation; returns None on overflow/underflow.

Sourceval abs : t -> t option

Finds an absolute value; returns None on overflow.

Sourceval add : t -> t -> t option

Performs addition; returns None on overflow/underflow.

Sourceval sub : t -> t -> t option

Performs subtraction; returns None on overflow/underflow.

Sourceval mul : t -> t -> t option

Performs multiplication; returns None on overflow/underflow.

Sourceval div : t -> t -> t option

Performs division; returns None on overflow/underflow.

Sourceval rem : t -> t -> t option

Finds a remainder; returns None on overflow/underflow.

Sourceval bit_not : t -> t

Performs bitwise negation.

Sourceval bit_or : t -> t -> t

Performs bitwise disjunction.

Sourceval bit_and : t -> t -> t

Performs bitwise conjunction.

Sourceval bit_xor : t -> t -> t

Performs bitwise exclusive disjunction.

Sourceval shift_left : t -> t -> t option

Performs left shifting; returns None on overflow/underflow.

Sourceval shift_right : t -> t -> t option

Performs right shifting; returns None on overflow/underflow.

This is a logical shift for unsigned integer types and arithmetic shift for signed integer types.

Sourceval min : t -> t -> t

Finds the minimum integer of two.

Sourceval max : t -> t -> t

Finds the maximum integer of two.

Sourceval of_int_exn : int -> t

Same as of_int but raises Out_of_range instead of returning None.

Sourceval of_string_exn : string -> t

Same as of_string but raises Out_of_range instead of returning None.

Sourceval succ_exn : t -> t

Finds a successor; raises Out_of_range on overflow.

Sourceval pred_exn : t -> t

Finds a predecessor; raises Out_of_range on underflow.

Sourceval neg_exn : t -> t

Performs unary negation; raises Out_of_range on overflow/underflow.

Sourceval abs_exn : t -> t

Finds an absolute value; raises Out_of_range on overflow.

Sourceval add_exn : t -> t -> t

Performs addition; raises Out_of_range on overflow/underflow.

Sourceval sub_exn : t -> t -> t

Performs subtraction; raises Out_of_range on overflow/underflow.

Sourceval mul_exn : t -> t -> t

Performs multiplication; raises Out_of_range on overflow/underflow.

Sourceval div_exn : t -> t -> t

Performs division; raises Out_of_range on overflow/underflow.

Sourceval rem_exn : t -> t -> t

Finds a remainder; raises Out_of_range on overflow/underflow.

Sourceval shift_left_exn : t -> t -> t

Performs left shifting; raises Out_of_range on overflow/underflow.

Sourceval shift_right_exn : t -> t -> t

Performs right shifting; raises Out_of_range on overflow/underflow.

This is a logical shift for unsigned integer types and arithmetic shift for signed integer types.

Sourceval to_string : t -> string

Prints a value in decimal; same as show.

Sourceval of_generic : generic -> t option

Constructs a value out of generic; returns None on overflow/underflow.

Sourceval of_generic_exn : generic -> t

Same as of_generic but raises Out_of_range instead of returning None.

Sourceval to_generic : t -> generic

Casts a value into generic.

Sourceval split : t -> u64 * u64

Same as U128.split but for i128.

OCaml

Innovation. Community. Security.