module Int63:63 bit signed integer typesig..end
In OCaml, the basic int type is fast because it is unboxed, but
it has a different size on 32 and 64 bit platforms (31 and 63 bits
respectively). If we want a large integer type we can use the
OCaml int64 type, but that is boxed and hence operations are
slow, even on 64 bit platforms.
This type gives us a large integer (up to 63 bits, therefore fine
for things involving eg. large disk file sizes), but retains
efficiency. On 64 bit platforms it degenerates into just a normal
int, hence unboxed and fast. On 32 bit platforms it degenerates
to a kind of int64, which is boxed and slow but hey 32 bit
platforms are going the way of all things anyway.
The implementation of this type is in the files int63_on_32.ml
or int63_on_64.ml for 32 bit and 64 bit platforms respectively.
The appropriate implementation is copied by the Makefile to
int63.ml.
type t
It is recommended to do:
open Int63.Operators
in your code so that you get the operators +^, -^ .. and the
type int63 directly, and can still use the less frequent
functions such as Int63.abs etc.
module Operators:sig..end
These functions are analogous to the similarly named
functions available in the standard library Int32 and
Int64 modules.
val zero : tval one : tval minus_one : tval neg : t -> tval add : t -> t -> tval sub : t -> t -> tval mul : t -> t -> tval div : t -> t -> tval rem : t -> t -> tval succ : t -> tval pred : t -> tval abs : t -> tval max_int : tval min_int : tval logand : t -> t -> tval logor : t -> t -> tval logxor : t -> t -> tval lognot : t -> tval shift_left : t -> int -> tval shift_right : t -> int -> tval shift_right_logical : t -> int -> t0 regardless of sign.val of_int : int -> tval to_int : t -> intval of_float : float -> tval to_float : t -> floatval of_int32 : int32 -> tval to_int32 : t -> int32val of_int64 : int64 -> tval to_int64 : t -> int64val of_nativeint : nativeint -> tval to_nativeint : t -> nativeintval of_string : string -> tval to_string : t -> stringval compare : t -> t -> int