Torbjörn Granlund tg at gmplib.org
Thu Sep 5 14:11:39 UTC 2019

Can div2 be done sloppily, e.g., by extracting the top 64 bits of the
dividend and the corresponding (up to) 64 bits of the divisor, and
invoke DIV1 on these bits?

OK, one needs to return a non-negative remainder, so a little bit of
adjustment might be needed.  But does the remainder need to be

Related to that: In hgcd2 you seem to handle a >= b just after a is set
to a residue mod b.  If that residue is principal, then clearly a >= b
cannot happen.  Perhaps I am reading the code wrong.  But the handling
of a >= b opens for a sloppy div1 and div2, which might result in
greater speed.

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list