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

mercurial at gmplib.org mercurial at gmplib.org
Sat Apr 25 16:02:15 UTC 2015


details:   /var/hg/gmp/rev/e041fd523a1f
changeset: 16583:e041fd523a1f
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Apr 25 17:49:11 2015 +0200
description:
mpn/generic/{powm,rootrem}.c: Use TMP_ALLOC_LIMBS_2

details:   /var/hg/gmp/rev/d23c0f65ea86
changeset: 16584:d23c0f65ea86
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Apr 25 17:51:33 2015 +0200
description:
mpn/generic/{remove,perfpow}.c: Remove redundant #ifdef

details:   /var/hg/gmp/rev/d88e1bd3cc6a
changeset: 16585:d88e1bd3cc6a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Apr 25 17:52:29 2015 +0200
description:
mpn/generic/hgcd_reduce.c: Use TMP_ALLOC_LIMBS_3

details:   /var/hg/gmp/rev/4e1b4e221e23
changeset: 16586:4e1b4e221e23
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Apr 25 17:57:11 2015 +0200
description:
ChangeLog

details:   /var/hg/gmp/rev/3fcee237e6d5
changeset: 16587:3fcee237e6d5
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Apr 25 17:59:53 2015 +0200
description:
typo in a comment

diffstat:

 ChangeLog                 |   8 ++++++++
 mpn/generic/hgcd_reduce.c |   6 +++---
 mpn/generic/perfpow.c     |   9 +--------
 mpn/generic/powm.c        |   3 +--
 mpn/generic/remove.c      |  10 ++--------
 mpn/generic/rootrem.c     |   8 ++++----
 mpn/generic/toom44_mul.c  |   2 +-
 7 files changed, 20 insertions(+), 26 deletions(-)

diffs (147 lines):

diff -r 329ef20a36f2 -r 3fcee237e6d5 ChangeLog
--- a/ChangeLog	Tue Apr 21 17:25:29 2015 +0200
+++ b/ChangeLog	Sat Apr 25 17:59:53 2015 +0200
@@ -1,3 +1,11 @@
+2015-04-25 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/generic/hgcd_reduce.c: Use TMP_ALLOC_LIMBS_3.
+	* mpn/generic/remove.c: Remove redundant #ifdef.
+	* mpn/generic/perfpow.c: Likewise.
+	* mpn/generic/powm.c: Use TMP_ALLOC_LIMBS_2.
+	* mpn/generic/rootrem.c: Likewise.
+
 2015-04-21    <torbjorng at google.com>
 
 	* printf/sprintffuns.c (gmp_sprintf_final): Remove extra parameters.
diff -r 329ef20a36f2 -r 3fcee237e6d5 mpn/generic/hgcd_reduce.c
--- a/mpn/generic/hgcd_reduce.c	Tue Apr 21 17:25:29 2015 +0200
+++ b/mpn/generic/hgcd_reduce.c	Sat Apr 25 17:59:53 2015 +0200
@@ -143,9 +143,9 @@
       /* In the range of interest, mulmod_bnm1 should always beat mullo. */
       modn = mpn_mulmod_bnm1_next_size (nn + 1);
 
-      scratch = TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (modn, modn, M->n));
-      tp = TMP_ALLOC_LIMBS (modn);
-      sp = TMP_ALLOC_LIMBS (modn);
+      TMP_ALLOC_LIMBS_3 (tp, modn,
+			 sp, modn,
+			 scratch, mpn_mulmod_bnm1_itch (modn, modn, M->n));
 
       ASSERT (n <= 2*modn);
 
diff -r 329ef20a36f2 -r 3fcee237e6d5 mpn/generic/perfpow.c
--- a/mpn/generic/perfpow.c	Tue Apr 21 17:25:29 2015 +0200
+++ b/mpn/generic/perfpow.c	Sat Apr 25 17:59:53 2015 +0200
@@ -82,7 +82,7 @@
   y -= 1;  /* msb_index (xp, xn) */
 
   umul_ppmm (h, l, k, y);
-  h -= l == 0;  l--;	/* two-limb decrement */
+  h -= l == 0;  --l;	/* two-limb decrement */
 
   z = f - 1; /* msb_index (np, n) */
   if (h == 0 && l <= z)
@@ -184,14 +184,7 @@
   gmp_init_primesieve (&ps);
   b = (f + 3) >> 1;
 
-#ifdef TMP_ALLOC_LIMBS_3
   TMP_ALLOC_LIMBS_3 (ip, n, rp, n, tp, 5 * n);
-#else
-  tmp = TMP_ALLOC_LIMBS (7 * n);
-  ip = tmp; tmp += n;
-  rp = tmp; tmp += n;
-  tp = tmp; tmp += 5 * n;
-#endif
 
   MPN_ZERO (rp, n);
 
diff -r 329ef20a36f2 -r 3fcee237e6d5 mpn/generic/powm.c
--- a/mpn/generic/powm.c	Tue Apr 21 17:25:29 2015 +0200
+++ b/mpn/generic/powm.c	Sat Apr 25 17:59:53 2015 +0200
@@ -152,8 +152,7 @@
   TMP_DECL;
   TMP_MARK;
 
-  tp = TMP_ALLOC_LIMBS (un + n);
-  qp = TMP_ALLOC_LIMBS (un + 1);	/* FIXME: Put at tp+? */
+  TMP_ALLOC_LIMBS_2 (tp, un + n, qp, un + 1);
 
   MPN_ZERO (tp, n);
   MPN_COPY (tp + n, up, un);
diff -r 329ef20a36f2 -r 3fcee237e6d5 mpn/generic/remove.c
--- a/mpn/generic/remove.c	Tue Apr 21 17:25:29 2015 +0200
+++ b/mpn/generic/remove.c	Sat Apr 25 17:59:53 2015 +0200
@@ -99,15 +99,9 @@
 
   TMP_MARK;
 
-#ifdef TMP_ALLOC_LIMBS_3
   TMP_ALLOC_LIMBS_3 (qp, un + 1,	/* quotient, alternating */
 		     qp2, un + 1,	/* quotient, alternating */
 		     tp, (un + 1 + vn) / 2); /* remainder */
-#else
-  qp = TMP_ALLOC_LIMBS (2 * un + 2 + (un + 1 + vn) / 2);
-  qp2 = qp + un + 1;
-  tp = qp2 + un + 1;
-#endif
   pp = vp;
   pn = vn;
 
@@ -128,7 +122,7 @@
 
       pwpsp[npowers] = pp;
       pwpsn[npowers] = pn;
-      npowers++;
+      ++npowers;
 
       if (((mp_bitcnt_t) 2 << npowers) - 1 > cap)
 	break;
@@ -149,7 +143,7 @@
 
   pwr = ((mp_bitcnt_t) 1 << npowers) - 1;
 
-  for (i = npowers - 1; i >= 0; i--)
+  for (i = npowers; --i >= 0;)
     {
       pn = pwpsn[i];
       if (qn < pn)
diff -r 329ef20a36f2 -r 3fcee237e6d5 mpn/generic/rootrem.c
--- a/mpn/generic/rootrem.c	Tue Apr 21 17:25:29 2015 +0200
+++ b/mpn/generic/rootrem.c	Sat Apr 25 17:59:53 2015 +0200
@@ -105,9 +105,9 @@
       TMP_DECL;
       TMP_MARK;
       wn = un + k;
-      wp = TMP_ALLOC_LIMBS (wn); /* will contain the padded input */
       sn = m + 2; /* ceil(un/k) + 1 */
-      sp = TMP_ALLOC_LIMBS (sn); /* approximate root of padded input */
+      TMP_ALLOC_LIMBS_2 (wp, wn, /* will contain the padded input */
+			 sp, sn); /* approximate root of padded input */
       MPN_COPY (wp + k, up, un);
       MPN_ZERO (wp, k);
       rn = mpn_rootrem_internal (sp, NULL, wp, wn, k, 1);
@@ -224,9 +224,9 @@
      fits in un limbs, the number of extra limbs needed is bounded by
      ceil(k*log2(3/2)/GMP_NUMB_BITS). */
 #define EXTRA 2 + (mp_size_t) (0.585 * (double) k / (double) GMP_NUMB_BITS)
-  qp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain quotient and remainder
+  TMP_ALLOC_LIMBS_2 (qp, un + EXTRA, /* will contain quotient and remainder
 					of R/(k*S^(k-1)), and S^k */
-  wp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain S^(k-1), k*S^(k-1),
+		     wp, un + EXTRA); /* will contain S^(k-1), k*S^(k-1),
 					and temporary for mpn_pow_1 */
 
   wp[0] = 1; /* {sp,sn}^(k-1) = 1 */
diff -r 329ef20a36f2 -r 3fcee237e6d5 mpn/generic/toom44_mul.c
--- a/mpn/generic/toom44_mul.c	Tue Apr 21 17:25:29 2015 +0200
+++ b/mpn/generic/toom44_mul.c	Sat Apr 25 17:59:53 2015 +0200
@@ -219,7 +219,7 @@
   /* Compute apx = a0 + a1 + a2 + a3 and amx = a0 - a1 + a2 - a3.  */
   flags = (enum toom7_flags) (flags | toom7_w3_neg & mpn_toom_eval_dgr3_pm1 (apx, amx, ap, n, s, tp));
 
-  /* Compute bpx = b0 + b1 + b2 + b3 bnd bmx = b0 - b1 + b2 - b3.  */
+  /* Compute bpx = b0 + b1 + b2 + b3 and bmx = b0 - b1 + b2 - b3.  */
   flags = (enum toom7_flags) (flags ^ toom7_w3_neg & mpn_toom_eval_dgr3_pm1 (bpx, bmx, bp, n, t, tp));
 
   TOOM44_MUL_N_REC (vm1, amx, bmx, n + 1, tp);	/* vm1,  2n+1 limbs */


More information about the gmp-commit mailing list