[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FIXNUM considered unportable



What all this discussion says to me as a compiler implementor is that
I should give a warning when somebody uses type FIXNUM.

Ah, but show now I can think of a use of type FIXNUM from MACSYMA
(DOE-MACSYMA, CL-MACSYMA whatever), and it seems quite reasonable.

Given that we know that fixnum operations are more efficient than non-fixnum
we choose to do our math modulo various prime numbers that fit in a fixnum.
Macsyma has a list of the 10 or so bigest primes that fit in a fixnum for
each machine it runs on, and/or it can compute these on the fly, using the
(LSH -1 -1) idiom (or other more common-lisp ways of finding the greatest fixnum).
Well, thats part of the justification, the code would look something like:

(COND ((TYPEP *MODULUS* 'FIXNUM)
       (LET ()
        (DECLARE (FIXNUM *MODULUS*))
        ....frob... frob... frob...))
      ('ELSE
        ..... frob ... frob ...))