mpn_perfpow: do we need a special GCD for mp_bitcnt_t?
tg at gmplib.org
Thu Sep 4 15:20:27 UTC 2014
nisse at lysator.liu.se (Niels Möller) writes:
A compromise might be to add something like
#if MP_BITCNT_T_MAX < MP_LIMB_T_MAX
#error mp_limb_t too small !?
close to the code which assigns an mp_bitcnt_t to an mp_limb_t. At
least, this documents the assumption made. (Except that I don't think
MP_BITCNT_T_MAX exists, and the common way of writing it as
~(mp_bitcnt_t) 0 won't work in a preprocessor conditional).
In the Pers alimbs branch, I had to add lots of those macros.
Another alternative might be to define a gcd_11 function taking
uintmax_t arguments. However, I don't really trust uintmax_t; it's
specified in essentially the same way as "unsigned long long" was
originally specified, but long is often not the largest type in current
Let's not involve uintmax_t. A plain conditional, explicit casts in any
call, and a fall-back function such as gcd_bitcnt would be fine.
Or even cleaner, use gcd_bitcnt always and have the conditionals there.
Please encrypt, key id 0xC8601622
More information about the gmp-devel