Nails or no nails?

Evan Lavelle sa212+gmp at cyconix.com
Fri Jun 15 12:42:28 CEST 2007


I've been evaluating libtommath and GMP for use in a fixed-precision 
integer application (neither currently does fixed-precision, so I have 
to modify/add various bits of code).

The most fundamental difference between them seems to be that ltm always 
uses a 1-bit nail in digit words. If digits are 32 bits, for example, 
then you get 31 bits of data, and one bit which is only used for 
carry/borrow (it may also have other uses; I'm not sure).

The GMP code can be difficult to understand, but I think that configure 
defaults nails to false, and that digit words are always full of data, 
with no holes. It looks like there's an option to set 1 or 2 nail bits, 
but the manual says that this is experimental. The 'dumb' code always 
uses lots of nail bits.

If I'm adding code, then it's more difficult to use nails, but at least 
it's then compatible with ltm.

So, I guess what I'm asking is, how much use do you think nails actually 
are? Is there a significant potential speed-up benefit? Do nails help 
with anything other than addition and subtraction? Are you intending to 
make more use of nails in the future?

Thanks -

Evan


More information about the gmp-discuss mailing list