div_qr_1 interface

Torbjorn Granlund tg at gmplib.org
Sun Oct 20 16:42:37 CEST 2013

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

  Torbjorn Granlund <tg at gmplib.org> writes:
  > I think x86-64, x86-32, arm32, arm64, powerpc-64, sparc-64 matter.
  > Unfortunately, powerpc-64 (and -32) return these types onto the stack
  > via an implicit pointer.
  Ok, I think I'll stick to using a separate pointer for qh then.

I did not mean to argue against returning a structure.  Actually, it is
more efficiently returned than I thought...

  Storing qh early may also have the advantage of allowing more tail

Which tail call?

  I'm about to push the first step, with C implementations of mpn_div_qr_1
  and mpn_div_qr_1n_pi1.
Should we unconfuse ourselves and users about what type of inverse is to
be passed?  The "pi1" moniker might be replaced.  How many one-limb
inverse types do we currently consider?

I don't think fully descriptive names would be viable, since they would
be too long.  For plain 1/b mod \beta^k, perhaps use _bik, where k is a

For the various Euclidean inverses, _iak, _ibk, _ick is one alternative,
for "type a", "type b", etc.  Or some other more clever letters.

  I was a bit confused here. mpn_div_qr_1 is intended as a public
Indeed.  See http://gmplib.org/devel/ for my thinking about division
functions, from a few years back...


More information about the gmp-devel mailing list