MLton 20051202

MLtonIntInf

Home Index

    signature MLTON_INT_INF =
       sig
          type t

          val areSmall: t * t -> bool
          val gcd: t * t -> t
          val isSmall: t -> bool
          datatype rep =
             Big of word vector
           | Small of int
          val rep: t -> rep
       end

MLton represents an arbitrary precision integer either as an unboxed 32 bit word with the bottom bit set to 1 and the top 31 bits representing a small integer in [-230, 230), or as a pointer to a vector of words where the first word indicates the sign and the rest are the limbs of GnuMP big integer.

- `type t`

the same as type `IntInf.int`.

- `areSmall (a, b)`

returns true iff both `a` and `b` are small.

- `gcd (a, b)`

uses the GnuMP's fast gcd implementation.

- `isSmall a`

returns true iff `a` is small.

- `datatype rep`

the underlying representation of an `IntInf.int`.

- `rep i`

returns the underlying representation of `i`.

Last edited on 2005-12-02 03:46:17 by MatthewFluet.