Common-Lisp distinguishes two types of integer types: bignums and fixnums. A
fixnum is a small integer, which ideally occupies only a word of memory and
which is between the values MOST-NEGATIVE-FIXNUM
and
MOST-POSITIVE-FIXNUM
. A bignum is any integer which is not a fixnum and
it is only constrained by the amount of memory available to represent it.
In ECL a fixnum is an integer that, together with the tag bits, fits in a
word of memory. The size of a word, and thus the size of a fixnum, varies from
one architecture to another, and you should refer to the types and constants in
the ecl.h
header to make sure that your C extensions are portable.
All other integers are stored as bignums, they are not immediate objects, they
take up a variable amount of memory and the GNU Multiprecision Library is
required to create, manipulate and calculate with them.
C type: cl_fixnumThis is a C signed integer type capable of holding a whole fixnum without any loss of precision. The opposite is not true, and you may create a
cl_fixnum
which exceeds the limits of a fixnum and should be stored as a bignum.
C type: cl_indexThis is a C unsigned integer type capable of holding a nonnegative fixnum without loss of precision. Typically, a
cl_index
is used as an index into an array, or into a proper list, etc.
Constant:MOST_NEGATIVE_FIXNUM
Constant:MOST_POSITIVE_FIXNUM
These constants mark the limits of a fixnum.
Function: boolFIXNUM_MINUSP
(cl_objecto
)Function: boolFIXNUM_PLUSP
(cl_objecto
)These functions perform the checks (
o
< 0) and (0 <=o
), respectively.
Function: cl_objectMAKE_FIXNUM
(cl_fixnumn
)Function: cl_fixnumfix
(cl_objecto
)
MAKE_FIXNUM
andfix
convert from an integer to a lisp object of fixnum type and vice versa. These functions no not check their arguments.