Ciao,

Il 2020-02-01 16:43 ni...@lysator.liu.se ha scritto:
Jacob Glickman <jhg...@bucknell.edu> writes:

Do these improvements warrant any changes to the mpn_jacobi_base function (with JACOBI_BASE_METHOD = 4) in mpn/generic/jacbase.c? I use this function

Me too, when writing a (partial) jacobi function for mini-gmp, got inspiration from jacbase.c, the JACOBI_BASE_METHOD == 4 variant.

I just pushed a small optimisation to mini-gmp:
https://gmplib.org/repo/gmp/rev/2a398323c9c7

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.

Ĝis,
m
_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel

Reply via email to