Number of limbs for an unsigned long

Marc Glisse marc.glisse at inria.fr
Tue Mar 15 16:48:35 CET 2011


On Tue, 15 Mar 2011, Torbjorn Granlund wrote:

> So, disregarding the unused __GMP_SHORT_LIMB, the answer is that
> mpz_set_si is right; you may assume any unsigned long fits in limb
> unless we have nails.  For nails, we never supported a nail greater than
> half the limb.
>
> For nails (which incidentally do not work since GMP 5.0, but might be
> revived) you need to check the actual value.  You may make the logic
> more compex, since with LONG_LONG_LIMBS and nails, any unsinged long
> will fit...

Ah, limbs (including nails) are strictly larger than long if and only if 
_LONG_LONG_LIMB is defined. That should do it, thanks.

-- 
Marc Glisse


More information about the gmp-devel mailing list