test if an unsigned long fits in a limb.

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Tue Mar 6 20:18:01 CET 2012


Inspired by Marc's messages on -discuss, I looked into some pieces of code
dealing with the possible limb/long difference.

The condition limb != unsigned long is, I fear, poorly tested. All the
code I've found about it, assumes that an UI fits in one or two limbs, but
the tests are different.

mpz/iset_ui.c, line 30, reads:
#if BITS_PER_ULONG > GMP_NUMB_BITS  /* avoid warnings about shift amount */

mpz/iset_si.c, line 39:
#if GMP_NAIL_BITS != 0

gmpxx.h, line 61:
#if GMP_NAIL_BITS != 0 && ! defined _LONG_LONG_LIMB

gmp-h.in, line 1730:
#if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)

The first one is the one I prefer. Has this problem been addressed in the
alimb branch?

Regards,
m

-- 
http://bodrato.it/software/combinatorics.html



More information about the gmp-devel mailing list