Bug found in nightbuilds

Niels Möller nisse at lysator.liu.se
Sun Feb 16 17:08:56 UTC 2014


Torbjorn Granlund <tg at gmplib.org> writes:

> Also, keeping DIV_QR_1_UNNORM_THRESHOLD >= 1 surely does the job, but it
> puts another test it the critical path.  Perhaps that's unavoidable, I
> haven't checked.

I'm not entirely sure I follow you, but I guess the alternative is
something like

  if (nn > 0)
    if (BELOW_THRESHOLD (...))
      {
        do { ... nn-- ...} while (nn > 0);
      }
    else
      {
        invert_limb(...);
        return div_qr_1n_pi1 (...) >> cnt;
      }
  return uh;

Then the BELOW_THRESHOLD test can be always false when the threshold is
0. A clever enough compiler could optimize it away also if the threshold
is 1, but I have no idea if gcc does that.

Regards,
/Niels

-- 
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