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

mercurial at gmplib.org mercurial at gmplib.org
Sat Jun 6 12:12:32 UTC 2015


details:   /var/hg/gmp/rev/18cad7a063b7
changeset: 16673:18cad7a063b7
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jun 06 14:11:28 2015 +0200
description:
mpn/generic/toom22_mul.c: some more ASSERTs.

details:   /var/hg/gmp/rev/a4aef9ca8a11
changeset: 16674:a4aef9ca8a11
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jun 06 14:12:11 2015 +0200
description:
tests/mpn/t-toom22.c: stop testing some unsafe (unused) corner cases.

diffstat:

 mpn/generic/toom22_mul.c |  7 ++++---
 tests/mpn/t-toom22.c     |  4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r c86f4fc0aafe -r a4aef9ca8a11 mpn/generic/toom22_mul.c
--- a/mpn/generic/toom22_mul.c	Mon Jun 01 22:57:49 2015 +0200
+++ b/mpn/generic/toom22_mul.c	Sat Jun 06 14:12:11 2015 +0200
@@ -202,9 +202,10 @@
   ASSERT (cy + 1  <= 3);
   ASSERT (cy2 <= 2);
 
-  mpn_incr_u (pp + 2 * n, cy2);
+  MPN_INCR_U (pp + 2 * n, s + t, cy2);
   if (LIKELY (cy <= 2))
-    mpn_incr_u (pp + 3 * n, cy);
+    /* if s+t==n, cy is zero, but we should not acces pp[3*n] at all. */
+    MPN_INCR_U (pp + 3 * n, s + t - n, cy);
   else
-    mpn_decr_u (pp + 3 * n, 1);
+    MPN_DECR_U (pp + 3 * n, s + t - n, 1);
 }
diff -r c86f4fc0aafe -r a4aef9ca8a11 tests/mpn/t-toom22.c
--- a/tests/mpn/t-toom22.c	Mon Jun 01 22:57:49 2015 +0200
+++ b/tests/mpn/t-toom22.c	Sat Jun 06 14:12:11 2015 +0200
@@ -1,10 +1,10 @@
 #define mpn_toomMN_mul mpn_toom22_mul
 #define mpn_toomMN_mul_itch mpn_toom22_mul_itch
-#define MIN_AN 2
+#define MIN_AN 4
 
 #define MIN_BN(an)				\
   ((an) >= 2*MUL_TOOM22_THRESHOLD		\
    ? (an) + 2 - MUL_TOOM22_THRESHOLD		\
-   : ((an)+1)/2 + 1)
+   : ((an)+1)/2 + 1 + (an & 1))
 
 #include "toom-shared.h"


More information about the gmp-commit mailing list