hgcd2_jacobi

Niels Möller nisse at lysator.liu.se
Thu Feb 6 05:10:12 UTC 2020


Marco Bodrato <bodrato at mail.dm.unipi.it> writes:

> And maybe a similar optimisation for mpn/generic/jacbase.c should be
> committed.
>
> I propose:
> diff -r 2624648aa8e1 mpn/generic/jacbase.c
> --- a/mpn/generic/jacbase.c     Sun Feb 02 16:06:52 2020 +0100
> +++ b/mpn/generic/jacbase.c     Sun Feb 02 16:10:28 2020 +0100
> @@ -235,7 +235,7 @@
>        bit ^= c & (b ^ (b >> 1));
>        a >>= c;
>      }
> -  while (b > 0);
> +  while (a > 0);
>
>    return 1-2*(bit & 1);
>  }
>
> It saves an unneeded round of the loop.

Looks good to me.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list