package integers

  1. Overview
  2. Docs

Signed 64-bit integer type and operations.

include Unsigned.S with type t = int64
type t = int64
val add : t -> t -> t

Addition.

val sub : t -> t -> t

Subtraction.

val mul : t -> t -> t

Multiplication.

val div : t -> t -> t

Division. Raise Division_by_zero if the second argument is zero.

val rem : t -> t -> t

Integer remainder. Raise Division_by_zero if the second argument is zero.

val max_int : t

The greatest representable integer.

val logand : t -> t -> t

Bitwise logical and.

val logor : t -> t -> t

Bitwise logical or.

val logxor : t -> t -> t

Bitwise logical exclusive or.

val shift_left : t -> int -> t

shift_left x y shifts x to the left by y bits.

val shift_right : t -> int -> t

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 "int_of_string" 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 zero : t

The integer 0.

val one : t

The integer 1.

val lognot : t -> t

Bitwise logical negation.

val succ : t -> t

Successor.

val pred : t -> t

Predecessor.

val compare : t -> t -> int

The comparison function for unsigned integers, with the same specification as Pervasives.compare.

val equal : t -> t -> bool

Tests for equality, with the same specification as Pervasives.(=).

val max : t -> t -> t

max x y is the greater of x and y

val min : t -> t -> t

min x y is the lesser of x and y

val pp : Format.formatter -> t -> unit

Output the result of to_string on a formatter.

module Infix : sig ... end

Infix names for the unsigned integer operations.

val neg : t -> t

Unary negation.

val abs : t -> t

Return the absolute value of its argument.

val minus_one : t

The value -1

val min_int : t

The smallest representable integer.

val shift_right_logical : t -> int -> t

shift_right_logical x y shifts x to the right by y bits. See Int32.shift_right_logical.

val of_nativeint : nativeint -> t

Convert the given nativeint value to a signed integer.

val to_nativeint : t -> nativeint

Convert the given signed integer to a nativeint value.

val of_int64 : int64 -> t

Convert the given int64 value to a signed integer.

val to_int64 : t -> int64

Convert the given signed integer to an int64 value.

OCaml

Innovation. Community. Security.