[Gmp-commit] /var/hg/gmp: mpn/generic/gcd_1.c: Delete unused code variant for...

mercurial at gmplib.org mercurial at gmplib.org
Mon May 28 19:17:41 UTC 2018


details:   /var/hg/gmp/rev/0fc00255ab6b
changeset: 17633:0fc00255ab6b
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Mon May 28 21:16:54 2018 +0200
description:
mpn/generic/gcd_1.c: Delete unused code variant for USE_ZEROTAB != 0.

diffstat:

 ChangeLog           |   5 +++++
 mpn/generic/gcd_1.c |  30 ------------------------------
 2 files changed, 5 insertions(+), 30 deletions(-)

diffs (66 lines):

diff -r e4849ae7c974 -r 0fc00255ab6b ChangeLog
--- a/ChangeLog	Mon May 28 06:24:27 2018 +0200
+++ b/ChangeLog	Mon May 28 21:16:54 2018 +0200
@@ -1,3 +1,8 @@
+2018-05-28  Niels Möller  <nisse at lysator.liu.se>
+
+	* mpn/generic/gcd_1.c (mpn_gcd_1) [USE_ZEROTAB]: Delete unused code
+	variant for USE_ZEROTAB != 0.
+
 2018-05-20 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* bootstrap.c: Define DONT_USE_FLOAT_H before including mini-gmp.
diff -r e4849ae7c974 -r 0fc00255ab6b mpn/generic/gcd_1.c
--- a/mpn/generic/gcd_1.c	Mon May 28 06:24:27 2018 +0200
+++ b/mpn/generic/gcd_1.c	Mon May 28 21:16:54 2018 +0200
@@ -35,20 +35,6 @@
 #define GCD_1_METHOD 2
 #endif
 
-#define USE_ZEROTAB 0
-
-#if USE_ZEROTAB
-#define MAXSHIFT 4
-#define MASK ((1 << MAXSHIFT) - 1)
-static const unsigned char zerotab[1 << MAXSHIFT] =
-{
-#if MAXSHIFT > 4
-  5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-#endif
-  4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
-};
-#endif
-
 /* Does not work for U == 0 or V == 0.  It would be tough to make it work for
    V == 0 since gcd(x,0) = x, and U does not generally fit in an mp_limb_t.
 
@@ -161,21 +147,6 @@
       /* u <-- |u - v| */
       ulimb = (t ^ vgtu) - vgtu;
 
-#if USE_ZEROTAB
-      /* Number of trailing zeros is the same no matter if we look at
-       * t or ulimb, but using t gives more parallelism. */
-      c = zerotab[t & MASK];
-
-      while (UNLIKELY (c == MAXSHIFT))
-	{
-	  ulimb >>= MAXSHIFT;
-	  if (0)
-	  strip_u_maybe:
-	    vlimb >>= 1;
-
-	  c = zerotab[ulimb & MASK];
-	}
-#else
       if (0)
 	{
 	strip_u_maybe:
@@ -183,7 +154,6 @@
 	  t = ulimb;
 	}
       count_trailing_zeros (c, t);
-#endif
       ulimb = (ulimb >> c) >> 1;
     }
 


More information about the gmp-commit mailing list