[Gmp-commit] /var/hg/gmp: Delete USE_ZEROTAB from gcdext_1.c.

mercurial at gmplib.org mercurial at gmplib.org
Sun Nov 24 22:03:26 UTC 2019


details:   /var/hg/gmp/rev/69d225a203b9
changeset: 17980:69d225a203b9
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Sun Nov 24 23:02:33 2019 +0100
description:
Delete USE_ZEROTAB from gcdext_1.c.

* mpn/generic/gcdext_1.c [USE_ZEROTAB]: Delete code variant for
USE_ZEROTAB != 0. Was used in the currently disabled binary
gcdext.

diffstat:

 ChangeLog              |   6 ++++
 mpn/generic/gcdext_1.c |  65 +++----------------------------------------------
 2 files changed, 11 insertions(+), 60 deletions(-)

diffs (115 lines):

diff -r e1a085445c8e -r 69d225a203b9 ChangeLog
--- a/ChangeLog	Wed Nov 20 23:16:40 2019 +0100
+++ b/ChangeLog	Sun Nov 24 23:02:33 2019 +0100
@@ -1,3 +1,9 @@
+2019-11-24  Niels Möller  <nisse at lysator.liu.se>
+
+	* mpn/generic/gcdext_1.c [USE_ZEROTAB]: Delete code variant for
+	USE_ZEROTAB != 0. Was used in the currently disabled binary
+	gcdext.
+
 2019-11-16 Seth Troisi <sethtroisi at google.com>
 
 	* tune/common.c (speed_mpn_perfect_power_p): New function.
diff -r e1a085445c8e -r 69d225a203b9 mpn/generic/gcdext_1.c
--- a/mpn/generic/gcdext_1.c	Wed Nov 20 23:16:40 2019 +0100
+++ b/mpn/generic/gcdext_1.c	Sun Nov 24 23:02:33 2019 +0100
@@ -39,21 +39,8 @@
 #define GCDEXT_1_BINARY_METHOD 2
 #endif
 
-#ifndef USE_ZEROTAB
-#define USE_ZEROTAB 1
-#endif
-
 #if GCDEXT_1_USE_BINARY
 
-#if USE_ZEROTAB
-static unsigned char zerotab[0x40] = {
-  6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-  4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-  5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-  4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
-};
-#endif
-
 mp_limb_t
 mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
 	      mp_limb_t u, mp_limb_t v)
@@ -110,48 +97,20 @@
       if (u > v)
 	{
 	  u -= v;
-#if USE_ZEROTAB
-	  count = zerotab [u & 0x3f];
-	  u >>= count;
-	  if (UNLIKELY (count == 6))
-	    {
-	      unsigned c;
-	      do
-		{
-		  c = zerotab[u & 0x3f];
-		  u >>= c;
-		  count += c;
-		}
-	      while (c == 6);
-	    }
-#else
+
 	  count_trailing_zeros (count, u);
 	  u >>= count;
-#endif
+
 	  t0 += t1; t1 <<= count;
 	  s0 += s1; s1 <<= count;
 	}
       else
 	{
 	  v -= u;
-#if USE_ZEROTAB
-	  count = zerotab [v & 0x3f];
-	  v >>= count;
-	  if (UNLIKELY (count == 6))
-	    {
-	      unsigned c;
-	      do
-		{
-		  c = zerotab[v & 0x3f];
-		  v >>= c;
-		  count += c;
-		}
-	      while (c == 6);
-	    }
-#else
+
 	  count_trailing_zeros (count, v);
 	  v >>= count;
-#endif
+
 	  t1 += t0; t0 <<= count;
 	  s1 += s0; s0 <<= count;
 	}
@@ -193,22 +152,8 @@
 
       /* Number of trailing zeros is the same no matter if we look at
        * d or u, but using d gives more parallelism. */
-#if USE_ZEROTAB
-      count = zerotab[d & 0x3f];
-      if (UNLIKELY (count == 6))
-	{
-	  unsigned c = 6;
-	  do
-	    {
-	      d >>= c;
-	      c = zerotab[d & 0x3f];
-	      count += c;
-	    }
-	  while (c == 6);
-	}
-#else
       count_trailing_zeros (count, d);
-#endif
+
       det_sign ^= vgtu;
 
       tx = vgtu & (t0 - t1);


More information about the gmp-commit mailing list