[Gmp-commit] /var/hg/gmp: Remove unread variables.

mercurial at gmplib.org mercurial at gmplib.org
Sat Mar 3 15:57:39 CET 2012


details:   /var/hg/gmp/rev/875d6f52774c
changeset: 14715:875d6f52774c
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Mar 03 15:57:36 2012 +0100
description:
Remove unread variables.

diffstat:

 ChangeLog                |  7 +++++++
 mpn/generic/hgcd_appr.c  |  4 +---
 mpn/generic/rootrem.c    |  5 -----
 mpn/generic/set_str.c    |  3 +--
 mpn/generic/toom42_mul.c |  3 +--
 tests/refmpn.c           |  3 +--
 6 files changed, 11 insertions(+), 14 deletions(-)

diffs (110 lines):

diff -r 2e930396711c -r 875d6f52774c ChangeLog
--- a/ChangeLog	Sat Mar 03 15:40:45 2012 +0100
+++ b/ChangeLog	Sat Mar 03 15:57:36 2012 +0100
@@ -1,5 +1,12 @@
 2012-03-03  Torbjorn Granlund  <tege at gmplib.org>
 
+	* mpn/generic/toom42_mul.c: Remove unread variable.
+	* mpn/generic/set_str.c (mpn_set_str_compute_powtab): Likewise.
+	* mpn/generic/rootrem.c (mpn_rootrem_internal): Likewise.
+	* tests/refmpn.c (refmpn_mul): Likewise.
+	* mpn/generic/hgcd_appr.c (mpn_hgcd_appr): Propagate mask computation
+	into ASSERT, remove variable.
+
 	* gmp-h.in (__GMP_PROTO): Remove.
 	* Strip __GMP_PROTO usage from all files.
 	* Strip prototype parameter names from all files.
diff -r 2e930396711c -r 875d6f52774c mpn/generic/hgcd_appr.c
--- a/mpn/generic/hgcd_appr.c	Sat Mar 03 15:40:45 2012 +0100
+++ b/mpn/generic/hgcd_appr.c	Sat Mar 03 15:57:36 2012 +0100
@@ -53,13 +53,11 @@
 	       struct hgcd_matrix *M, mp_ptr tp)
 {
   mp_size_t s;
-  mp_limb_t mask;
   int success = 0;
 
   ASSERT (n > 0);
-  mask = ap[n-1] | bp[n-1];
 
-  ASSERT (mask > 0);
+  ASSERT ((ap[n-1] | bp[n-1]) != 0);
 
   if (n <= 2)
     /* Implies s = n. A fairly uninteresting case but exercised by the
diff -r 2e930396711c -r 875d6f52774c mpn/generic/rootrem.c
--- a/mpn/generic/rootrem.c	Sat Mar 03 15:40:45 2012 +0100
+++ b/mpn/generic/rootrem.c	Sat Mar 03 15:57:36 2012 +0100
@@ -295,12 +295,7 @@
 	}
       else
 	{
-	  mp_ptr tp;
 	  qn = rn - wn; /* expected quotient size */
-	  /* tp must have space for wn limbs.
-	     The quotient needs rn-wn+1 limbs, thus quotient+remainder
-	     need altogether rn+1 limbs. */
-	  tp = qp + qn + 1;	/* put remainder in Q buffer */
 	  mpn_div_q (qp, rp, rn, wp, wn, scratch);
 	  qn += qp[qn] != 0;
 	}
diff -r 2e930396711c -r 875d6f52774c mpn/generic/set_str.c
--- a/mpn/generic/set_str.c	Sat Mar 03 15:40:45 2012 +0100
+++ b/mpn/generic/set_str.c	Sat Mar 03 15:57:36 2012 +0100
@@ -132,7 +132,7 @@
   mp_size_t n;
   mp_ptr p, t;
   unsigned normalization_steps;
-  mp_limb_t big_base, big_base_inverted;
+  mp_limb_t big_base;
   int chars_per_limb;
   size_t digits_in_base;
   mp_size_t shift;
@@ -141,7 +141,6 @@
 
   chars_per_limb = mp_bases[base].chars_per_limb;
   big_base = mp_bases[base].big_base;
-  big_base_inverted = mp_bases[base].big_base_inverted;
   count_leading_zeros (normalization_steps, big_base);
 
   p = powtab_mem_ptr;
diff -r 2e930396711c -r 875d6f52774c mpn/generic/toom42_mul.c
--- a/mpn/generic/toom42_mul.c	Sat Mar 03 15:40:45 2012 +0100
+++ b/mpn/generic/toom42_mul.c	Sat Mar 03 15:57:36 2012 +0100
@@ -61,7 +61,7 @@
   mp_size_t n, s, t;
   int vm1_neg;
   mp_limb_t cy, vinf0;
-  mp_ptr a0_a2, a1_a3;
+  mp_ptr a0_a2;
   mp_ptr as1, asm1, as2;
   mp_ptr bs1, bsm1, bs2;
   TMP_DECL;
@@ -92,7 +92,6 @@
   bs2 = TMP_SALLOC_LIMBS (n + 1);
 
   a0_a2 = pp;
-  a1_a3 = pp + n + 1;
 
   /* Compute as1 and asm1.  */
   vm1_neg = mpn_toom_eval_dgr3_pm1 (as1, asm1, ap, n, s, a0_a2) & 1;
diff -r 2e930396711c -r 875d6f52774c tests/refmpn.c
--- a/tests/refmpn.c	Sat Mar 03 15:40:45 2012 +0100
+++ b/tests/refmpn.c	Sat Mar 03 15:57:36 2012 +0100
@@ -1865,7 +1865,6 @@
 {
   mp_ptr tp;
   mp_size_t tn;
-  mp_limb_t cy;
 
   if (vn < TOOM3_THRESHOLD)
     {
@@ -1908,7 +1907,7 @@
 	refmpn_mul (wp + vn, up + vn, un - vn, vp, vn);
 
       MPN_COPY (wp, tp, vn);
-      cy = refmpn_add (wp + vn, wp + vn, un, tp + vn, vn);
+      ASSERT_NOCARRY (refmpn_add (wp + vn, wp + vn, un, tp + vn, vn));
     }
   else
     {


More information about the gmp-commit mailing list