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

mercurial at gmplib.org mercurial at gmplib.org
Mon May 21 22:13:50 CEST 2012


details:   /var/hg/gmp/rev/3bae8b5d5a33
changeset: 14993:3bae8b5d5a33
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon May 21 22:11:21 2012 +0200
description:
typos.

details:   /var/hg/gmp/rev/52db93244349
changeset: 14994:52db93244349
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon May 21 22:11:57 2012 +0200
description:
mpn/generic/toom8h_mul.c: Likewise.

diffstat:

 ChangeLog                            |   1 +
 mpn/generic/toom8h_mul.c             |  62 +++++++++++++++++++----------------
 mpn/generic/toom_interpolate_12pts.c |   2 +-
 mpn/generic/toom_interpolate_16pts.c |   2 +-
 4 files changed, 37 insertions(+), 30 deletions(-)

diffs (164 lines):

diff -r 822e81d2bede -r 52db93244349 ChangeLog
--- a/ChangeLog	Sun May 20 23:36:07 2012 +0200
+++ b/ChangeLog	Mon May 21 22:11:57 2012 +0200
@@ -1,6 +1,7 @@
 2012-05-21 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpn/generic/toom8_sqr.c: Reduce branches for recursion.
+	* mpn/generic/toom8h_mul.c: Likewise.
 
 2012-05-20  Torbjorn Granlund  <tege at gmplib.org>
 
diff -r 822e81d2bede -r 52db93244349 mpn/generic/toom8h_mul.c
--- a/mpn/generic/toom8h_mul.c	Sun May 20 23:36:07 2012 +0200
+++ b/mpn/generic/toom8h_mul.c	Mon May 21 22:11:57 2012 +0200
@@ -60,30 +60,36 @@
   (MUL_FFT_THRESHOLD >= 8 * MUL_TOOM8H_THRESHOLD)
 #endif
 
-#define TOOM8H_MUL_N_REC(p, a, b, n, ws)				\
+#define TOOM8H_MUL_N_REC(p, a, b, f, p2, a2, b2, n, ws)			\
   do {									\
     if (MAYBE_mul_basecase						\
-	&& BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD))			\
+	&& BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) {			\
       mpn_mul_basecase (p, a, n, b, n);					\
-    else if (MAYBE_mul_toom22						\
-	     && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD))		\
+      if (f) mpn_mul_basecase (p2, a2, n, b2, n);			\
+    } else if (MAYBE_mul_toom22						\
+	     && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) {		\
       mpn_toom22_mul (p, a, n, b, n, ws);				\
-    else if (MAYBE_mul_toom33						\
-	     && BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD))		\
+      if (f) mpn_toom22_mul (p2, a2, n, b2, n, ws);			\
+    } else if (MAYBE_mul_toom33						\
+	     && BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) {		\
       mpn_toom33_mul (p, a, n, b, n, ws);				\
-    else if (MAYBE_mul_toom44						\
-	     && BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD))		\
+      if (f) mpn_toom33_mul (p2, a2, n, b2, n, ws);			\
+    } else if (MAYBE_mul_toom44						\
+	     && BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD)) {		\
       mpn_toom44_mul (p, a, n, b, n, ws);				\
-    else if (! MAYBE_mul_toom8h						\
-	     || BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD))		\
+      if (f) mpn_toom44_mul (p2, a2, n, b2, n, ws);			\
+    } else if (! MAYBE_mul_toom8h					\
+	     || BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD)) {		\
       mpn_toom6h_mul (p, a, n, b, n, ws);				\
-    else								\
+      if (f) mpn_toom6h_mul (p2, a2, n, b2, n, ws);			\
+    } else {								\
       mpn_toom8h_mul (p, a, n, b, n, ws);				\
+      if (f) mpn_toom8h_mul (p2, a2, n, b2, n, ws);			\
+    }									\
   } while (0)
 
 #define TOOM8H_MUL_REC(p, a, na, b, nb, ws)		\
-  do {	mpn_mul (p, a, na, b, nb);			\
-  } while (0)
+  do { mpn_mul (p, a, na, b, nb); } while (0)
 
 /* Toom-8.5 , compute the product {pp,an+bn} <- {ap,an} * {bp,bn}
    With: an >= bn >= 86, an*5 <  bn * 11.
@@ -202,36 +208,36 @@
   /* $\pm1/8$ */
   sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 3, pp) ^
 	 mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 3, pp);
-  TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/8)*B(-1/8)*8^. */
-  TOOM8H_MUL_N_REC(r7, v2, v3, n + 1, wse); /* A(+1/8)*B(+1/8)*8^. */
+  /* A(-1/8)*B(-1/8)*8^. */ /* A(+1/8)*B(+1/8)*8^. */
+  TOOM8H_MUL_N_REC(pp, v0, v1, 2, r7, v2, v3, n + 1, wse);
   mpn_toom_couple_handling (r7, 2 * n + 1 + BIT_CORRECTION, pp, sign, n, 3*(1+half), 3*(half));
 
   /* $\pm1/4$ */
   sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 2, pp) ^
 	 mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 2, pp);
-  TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/4)*B(-1/4)*4^. */
-  TOOM8H_MUL_N_REC(r5, v2, v3, n + 1, wse); /* A(+1/4)*B(+1/4)*4^. */
+  /* A(-1/4)*B(-1/4)*4^. */ /* A(+1/4)*B(+1/4)*4^. */
+  TOOM8H_MUL_N_REC(pp, v0, v1, 2, r5, v2, v3, n + 1, wse);
   mpn_toom_couple_handling (r5, 2 * n + 1, pp, sign, n, 2*(1+half), 2*(half));
 
   /* $\pm2$ */
   sign = mpn_toom_eval_pm2 (v2, v0, p, ap, n, s, pp) ^
 	 mpn_toom_eval_pm2 (v3, v1, q, bp, n, t, pp);
-  TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-2)*B(-2) */
-  TOOM8H_MUL_N_REC(r3, v2, v3, n + 1, wse); /* A(+2)*B(+2) */
+  /* A(-2)*B(-2) */ /* A(+2)*B(+2) */
+  TOOM8H_MUL_N_REC(pp, v0, v1, 2, r3, v2, v3, n + 1, wse);
   mpn_toom_couple_handling (r3, 2 * n + 1, pp, sign, n, 1, 2);
 
   /* $\pm8$ */
   sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 3, pp) ^
 	 mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 3, pp);
-  TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-8)*B(-8) */
-  TOOM8H_MUL_N_REC(r1, v2, v3, n + 1, wse); /* A(+8)*B(+8) */
+  /* A(-8)*B(-8) */ /* A(+8)*B(+8) */
+  TOOM8H_MUL_N_REC(pp, v0, v1, 2, r1, v2, v3, n + 1, wse);
   mpn_toom_couple_handling (r1, 2 * n + 1 + BIT_CORRECTION, pp, sign, n, 3, 6);
 
   /* $\pm1/2$ */
   sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 1, pp) ^
 	 mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 1, pp);
-  TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1/2)*B(-1/2)*2^. */
-  TOOM8H_MUL_N_REC(r6, v2, v3, n + 1, wse); /* A(+1/2)*B(+1/2)*2^. */
+  /* A(-1/2)*B(-1/2)*2^. */ /* A(+1/2)*B(+1/2)*2^. */
+  TOOM8H_MUL_N_REC(pp, v0, v1, 2, r6, v2, v3, n + 1, wse);
   mpn_toom_couple_handling (r6, 2 * n + 1, pp, sign, n, 1+half, half);
 
   /* $\pm1$ */
@@ -240,15 +246,15 @@
     sign ^= mpn_toom_eval_dgr3_pm1 (v3, v1, bp, n, t,    pp);
   else
     sign ^= mpn_toom_eval_pm1 (v3, v1, q, bp, n, t,    pp);
-  TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-1)*B(-1) */
-  TOOM8H_MUL_N_REC(r4, v2, v3, n + 1, wse); /* A(1)*B(1) */
+  /* A(-1)*B(-1) */ /* A(1)*B(1) */
+  TOOM8H_MUL_N_REC(pp, v0, v1, 2, r4, v2, v3, n + 1, wse);
   mpn_toom_couple_handling (r4, 2 * n + 1, pp, sign, n, 0, 0);
 
   /* $\pm4$ */
   sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 2, pp) ^
 	 mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 2, pp);
-  TOOM8H_MUL_N_REC(pp, v0, v1, n + 1, wse); /* A(-4)*B(-4) */
-  TOOM8H_MUL_N_REC(r2, v2, v3, n + 1, wse); /* A(+4)*B(+4) */
+  /* A(-4)*B(-4) */ /* A(+4)*B(+4) */
+  TOOM8H_MUL_N_REC(pp, v0, v1, 2, r2, v2, v3, n + 1, wse);
   mpn_toom_couple_handling (r2, 2 * n + 1, pp, sign, n, 2, 4);
 
 #undef v0
@@ -258,7 +264,7 @@
 #undef wse
 
   /* A(0)*B(0) */
-  TOOM8H_MUL_N_REC(pp, ap, bp, n, wsi);
+  TOOM8H_MUL_N_REC(pp, ap, bp, 0, pp, ap, bp, n, wsi);
 
   /* Infinity */
   if( half != 0) {
diff -r 822e81d2bede -r 52db93244349 mpn/generic/toom_interpolate_12pts.c
--- a/mpn/generic/toom_interpolate_12pts.c	Sun May 20 23:36:07 2012 +0200
+++ b/mpn/generic/toom_interpolate_12pts.c	Mon May 21 22:11:57 2012 +0200
@@ -240,7 +240,7 @@
   mpn_sub_n (r4, r4, r5, n3p1); /* can be negative */
   DO_mpn_sublsh_n (r4, r5, n3p1, 8, wsi); /* can be negative */
 #endif
-  /* A division by 2835x4 followsi. Warning: the operand can be negative! */
+  /* A division by 2835x4 follows. Warning: the operand can be negative! */
   mpn_divexact_by2835x4(r4, r4, n3p1);
   if ((r4[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-3))) != 0)
     r4[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-2));
diff -r 822e81d2bede -r 52db93244349 mpn/generic/toom_interpolate_16pts.c
--- a/mpn/generic/toom_interpolate_16pts.c	Sun May 20 23:36:07 2012 +0200
+++ b/mpn/generic/toom_interpolate_16pts.c	Mon May 21 22:11:57 2012 +0200
@@ -395,7 +395,7 @@
   DO_mpn_addlsh_n (r6, r5, n3p1, 8, wsi); /* can give a carry */
   DO_mpn_sublsh_n (r6, r5, n3p1, 4, wsi); /* can be negative */
 #endif
-  /* A division by 255x4 followsi. Warning: the operand can be negative! */
+  /* A division by 255x4 follows. Warning: the operand can be negative! */
   mpn_divexact_by255x4(r6, r6, n3p1);
   if ((r6[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-3))) != 0)
     r6[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-2));


More information about the gmp-commit mailing list