mpn_perfpow: do we need a special GCD for mp_bitcnt_t?
Torbjörn Granlund
tg at gmplib.org
Mon Sep 1 12:40:44 UTC 2014
nisse at lysator.liu.se (Niels Möller) writes:
> Using mpn_remove does not solve a little issue, the mixed use of
> mp_bitcnt_t and mp_limb_t. When a prime factor is removed from the
> examined number, the exponent is returned as mp_bitcnt_t, the returned
> value is then casted to mp_limb_t, because we need the GCD of the
> exponents and mpn_gcd_1 wants limbs.
And when can there be a problem? If the mp_limb_t type is smaller than
mp_bitcnt_t? I guess that could happen if configuring with artificially
small limbs, but not otherwise?
I am not aware of any configutations where mp_limb_t is the smaller of
the two. But I feel bothered by type mixing such as this.
I mean to integrate Per Olofsson's mini-limb patches at some point in
the not very distant future. They require separation in a few more
places where we (ab)use mp_limb_t for conceptually other data types.
Vagely related: We chould have an mpn_gcd_11 function, accepting two
limb-size arguments.
Which would then be in assembly. This would obsolete the many mpn_gcd_1
implementations, I think.
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-devel
mailing list