math/pgen.c: Have `steps' and `tests' count down as documented.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 28 Apr 2022 17:30:20 +0000 (18:30 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 1 May 2022 17:54:55 +0000 (18:54 +0100)
commit1222a44ad62e577af2f1af6f7aee831e89793965
treee39f1a43eef76c01975dfb4ec406d0fcf8a03ca4
parenta938be516ed8fd8313ff3d061dd4b0f2d9acfa0e
math/pgen.c: Have `steps' and `tests' count down as documented.

This was how they worked originally, but they were changed a long time
ago to count up from zero instead.  This makes it impossible for a
stepper or tester function to know in advance how many times it will be
invoked, which turns out to be important for a forthcoming change.

The reason it was changed wasn't explained in the commit
(283b9af095a5b24ae71b49a6d2dcbdcdaae47c40) that made it, but I deduce
that it was so that `pgen_test' could identify the first test round and
use the somewhat faster approach of using (the residue whose Montgomery
REDC representative is) 2, rather than a random witness.  That change
has now been undone, so we can restore the documented behaviour.
math/pgen.c