mpn_perfpow: do we need a special GCD for mp_bitcnt_t?

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Mon Sep 1 09:33:56 UTC 2014


Ciao,

I removed some code from mpn_perfpow, because it did the same job of the
more carefully refined mpn_remove function.

I measured a 5% speed-up with
$ time tests/mpz/t-perfpow 10000

Moreover
$ valgrind tests/mpz/t-perfpow 10000
says that also the total memory allocated is smaller with the new code.

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.

Should we write an "ad hoc" GCD function for mp_bitcnt_t? We expect small
exponents and small results here...

Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list