Division with on-the-fly normalization

Niels Möller nisse at lysator.liu.se
Fri Mar 18 13:17:09 CET 2011

Another, more concise, reply...

Torbjorn Granlund <tg at gmplib.org> writes:

> You're suggesting that we use the 5 word structure also for the case
> where the divisor is already normalised, up from 1 word today?

If I cut it down to

    typedef struct {
      mp_limb_t inv32;
      int shift;
    } gmp_pi1_t;

do you think the rest of the patch is ok? 

The only material changes are then to add the shift count, which will be
zero for all current users, to pass a const gmp_pi1_t * where current
code passes either an mp_limb_t or a (not const) gmp_pi1_t *, and the
split of invert_pi1 into invert_3by2 and an extended invert_pi1.

(I'm trying to get to a state where up-front normalization can be
eliminated in small pieces, but it makes sense to me to get the larger
gmp_pi1_t interface changes committed first).


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list