3 ms·
Surprised no one has mentioned the TADDCC instruction that Sun put in the 32-bit SPARC ISA for Franz Lisp, short for "Tagged ADD and set Condition Codes". This
by ScottBurson 10y ago
Surprised no one has mentioned the TADDCC instruction that Sun put in the 32-bit SPARC ISA for Franz Lisp, short for "Tagged ADD and set Condition Codes". This instruction, along with performing a normal add, would also set the overflow bit if the two low-order bits of either operand were nonzero. Thus it had baked in the assumption that the fixnum tag was 00. A subsequent instruction could branch on the overflow bit to the bignum/overflow handler, or if the implementor wanted to use a trap instead, there was the TADDCCTV variant that also trapped on overflow.
The 64-bit SPARC ISA has no such instruction. I guess it was concluded that a superscalar CPU could do well enough with a short sequence of general-purpose instructions, and it was better not to build in assumptions as to how a Lisp implementation would want to represent numbers, and Lisp was no longer very commercially important anyhow at that point in Sun's existence.
Anyway, if I ruled the universe, I would declare arbitrary-precision integers to be the default, but provide ways for the programmer to turn off the overflow check for specific operations as needed. This is exactly what Common Lisp does, though its notation for suppressing the check is rather verbose.