gmp_pi1_t

Torbjorn Granlund tg at gmplib.org
Sat Dec 12 14:37:08 CET 2009


nisse at lysator.liu.se (Niels Möller) writes:

  I'm tempted to remove the inv21 member of the gmp_pi1_t type. It's used
  in exactly one place, and there it's most likely better to use 3/2
  division and inv32 anyway.
  
I have no objections.

  If I do that, should I eliminate the gmp_pi1_t type as well, and pass a
  single limb (the remaining inv32 member) instead of a gmp_pi1_t *? Or do
  we expect that other members are going to be added there (e.g., a
  normalization shift count if we extend some or all of the division
  functions to accept unnormalized divisors)?
  
I supoose there is no harm with keeping gmp_pi1_t, since it will be
easier to modify it.  Or do you see some harm?

I expect more gmp_piX_t structures in the future, BTW.

  A related change would be to put the 3/2 division into a macro, e.g
  named "udiv_qr_3by2_pi1" (or just udiv_qr_pi1, if the "pi1" label is
  intended to mean truncated division based on 3/2 division and the
  corresponding reciprocal).
  
I think a macro for that would be a good idea.  Perhaps we could rename
udiv_qrnnd_preinv along the same naming lines?  (The to gmp-impl.h
internal udiv_qrnnd_preinvN could probably be left with the old names.)

-- 
Torbjörn


More information about the gmp-devel mailing list