[Gmp-commit] /var/hg/gmp: 5 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sat Aug 2 12:32:55 UTC 2014


details:   /var/hg/gmp/rev/28e220a98c32
changeset: 16464:28e220a98c32
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Aug 02 14:25:13 2014 +0200
description:
mpn/generic/toom_interpolate_7pts.c: Replace an in-place add with add_n + INCR_U.

details:   /var/hg/gmp/rev/daf6d9274570
changeset: 16465:daf6d9274570
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Aug 02 14:25:43 2014 +0200
description:
ChangeLog

details:   /var/hg/gmp/rev/0317ef405dfe
changeset: 16466:0317ef405dfe
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Aug 02 14:29:59 2014 +0200
description:
tests/mpf/t-fits.c: use ui_sub instead of sub_ui+neg.

details:   /var/hg/gmp/rev/ecda7e778b8c
changeset: 16467:ecda7e778b8c
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Aug 02 14:31:25 2014 +0200
description:
mini-gmp/mini-gmp.c: Remove some unneeded variables.

details:   /var/hg/gmp/rev/08df9dc6fa9e
changeset: 16468:08df9dc6fa9e
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Aug 02 14:32:46 2014 +0200
description:
ChangeLog

diffstat:

 ChangeLog                           |   7 +++++++
 mini-gmp/mini-gmp.c                 |  23 +++++++++--------------
 mpn/generic/toom_interpolate_7pts.c |   7 +++++--
 tests/mpf/t-fits.c                  |   3 +--
 4 files changed, 22 insertions(+), 18 deletions(-)

diffs (143 lines):

diff -r 9e160b94cf3e -r 08df9dc6fa9e ChangeLog
--- a/ChangeLog	Wed Jul 30 00:23:34 2014 +0200
+++ b/ChangeLog	Sat Aug 02 14:32:46 2014 +0200
@@ -7,6 +7,13 @@
 	* mpq/cmp_ui.c: Remove a branch.
 	* mpq/cmp_si.c: Likewise.
 
+	* mpn/generic/toom_interpolate_7pts.c: Replace an in-place add
+	with add_n + INCR_U.
+
+	* tests/mpf/t-fits.c: use ui_sub instead of sub_ui+neg.
+
+	* mini-gmp/mini-gmp.c: Remove some useless variables.
+
 2014-07-27  Torbjörn Granlund  <tege at gmplib.org>
 
 	* mpn/x86/k7/gcd_1.asm: Use LEAL.
diff -r 9e160b94cf3e -r 08df9dc6fa9e mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Wed Jul 30 00:23:34 2014 +0200
+++ b/mini-gmp/mini-gmp.c	Sat Aug 02 14:32:46 2014 +0200
@@ -373,8 +373,8 @@
 static mp_size_t
 mpn_normalized_size (mp_srcptr xp, mp_size_t n)
 {
-  for (; n > 0 && xp[n-1] == 0; n--)
-    ;
+  while (n > 0 && xp[n-1] == 0)
+    --n;
   return n;
 }
 
@@ -383,10 +383,8 @@
 void
 mpn_zero (mp_ptr rp, mp_size_t n)
 {
-  mp_size_t i;
-
-  for (i = 0; i < n; i++)
-    rp[i] = 0;
+  while (--n >= 0)
+    rp[n] = 0;
 }
 
 mp_limb_t
@@ -607,7 +605,6 @@
 {
   mp_limb_t high_limb, low_limb;
   unsigned int tnc;
-  mp_size_t i;
   mp_limb_t retval;
 
   assert (n >= 1);
@@ -622,7 +619,7 @@
   retval = low_limb >> tnc;
   high_limb = (low_limb << cnt);
 
-  for (i = n; --i != 0;)
+  while (--n != 0)
     {
       low_limb = *--up;
       *--rp = high_limb | (low_limb >> tnc);
@@ -638,7 +635,6 @@
 {
   mp_limb_t high_limb, low_limb;
   unsigned int tnc;
-  mp_size_t i;
   mp_limb_t retval;
 
   assert (n >= 1);
@@ -650,7 +646,7 @@
   retval = (high_limb << tnc);
   low_limb = high_limb >> cnt;
 
-  for (i = n; --i != 0;)
+  while (--n != 0)
     {
       high_limb = *up++;
       *rp++ = low_limb | (high_limb << tnc);
@@ -1313,7 +1309,7 @@
 
   j = 0;
   w = sp[j++];
-  for (; --k > 0; )
+  while (--k != 0)
     w = w * b + sp[j++];
 
   rp[0] = w;
@@ -2070,8 +2066,7 @@
   else
     mpn_copyd (rp + limbs, u->_mp_d, un);
 
-  while (limbs > 0)
-    rp[--limbs] = 0;
+  mpn_zero (rp, limbs);
 
   r->_mp_size = (u->_mp_size < 0) ? - rn : rn;
 }
@@ -3322,7 +3317,7 @@
 mpz_fac_ui (mpz_t x, unsigned long n)
 {
   mpz_set_ui (x, n + (n == 0));
-  for (;n > 2;)
+  while (n > 2)
     mpz_mul_ui (x, x, --n);
 }
 
diff -r 9e160b94cf3e -r 08df9dc6fa9e mpn/generic/toom_interpolate_7pts.c
--- a/mpn/generic/toom_interpolate_7pts.c	Wed Jul 30 00:23:34 2014 +0200
+++ b/mpn/generic/toom_interpolate_7pts.c	Sat Aug 02 14:32:46 2014 +0200
@@ -7,7 +7,7 @@
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2006, 2007, 2009 Free Software Foundation, Inc.
+Copyright 2006, 2007, 2009, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -251,7 +251,10 @@
   cy = mpn_add_n (rp + 5*n, w4 + n, w5, n);
   MPN_INCR_U (w5 + n, n + 1, w4[2*n] + cy);
   if (w6n > n + 1)
-    ASSERT_NOCARRY (mpn_add (rp + 6*n, rp + 6*n, w6n, w5 + n, n + 1));
+    {
+      cy = mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, n + 1);
+      MPN_INCR_U (rp + 7*n + 1, w6n - n - 1, cy);
+    }
   else
     {
       ASSERT_NOCARRY (mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, w6n));
diff -r 9e160b94cf3e -r 08df9dc6fa9e tests/mpf/t-fits.c
--- a/tests/mpf/t-fits.c	Wed Jul 30 00:23:34 2014 +0200
+++ b/tests/mpf/t-fits.c	Sat Aug 02 14:32:46 2014 +0200
@@ -301,8 +301,7 @@
 
   mpf_set_ui (f, 1L);
   mpf_mul_2exp (f, f, BITS_PER_ULONG + 1);
-  mpf_sub_ui (f, f, 1L);
-  mpf_neg (f, f);
+  mpf_ui_sub (f, 1L, f);
   expr = "- (2^(BITS_PER_ULONG+1) - 1)";
   EXPECT (mpf_fits_ulong_p, 0);
   EXPECT (mpf_fits_uint_p, 0);


More information about the gmp-commit mailing list