Small operands gcd improvements

Torbjörn Granlund tg at
Tue Aug 6 12:48:25 UTC 2019

nisse at (Niels Möller) writes:

  But on second thought, maybe 

    while (u1 | v1)


    while (u1 || v1)

  is even simpler and efficient enough. Then we need not do anything
  special when the first operand gets small enough to fit in one limb.

We cannot enforce both to be zero.  Just imagine that our great divisor
is greater than GMP_NUMB_MAX.  :-)

The primary exit condition needs to be simple for performance (but one
might perhaps reenter the loop if a secondary exit condition is unmet).

Please encrypt, key id 0xC8601622

More information about the gmp-devel mailing list