summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2018-04-25 07:38:14 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2018-04-25 07:38:14 +0200
commit27e32ee310114371cf6c205b1827e6b36dc605ba (patch)
tree4953e7256762df5da575ee9d10acfd22ea144b2c
parente1b2ed8199101072ad4e525d2150ad63db380cc2 (diff)
downloadgmp-27e32ee310114371cf6c205b1827e6b36dc605ba.tar.gz
ChangeLog
-rw-r--r--ChangeLog5
-rw-r--r--mpn/generic/toom22_mul.c2
-rw-r--r--mpn/generic/toom2_sqr.c2
-rw-r--r--mpn/generic/toom32_mul.c2
4 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9097aee2e..2704decfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
+
+ * mpn/generic/toom2_sqr.c: Handle the cy=-1 branch slightly faster.
+ * mpn/generic/toom22_mul.c: Likewise. (Thanks Paul and Raphaël!)
+
2018-04-22 Niels Möller <nisse@lysator.liu.se>
From Martin Storsjö:
diff --git a/mpn/generic/toom22_mul.c b/mpn/generic/toom22_mul.c
index 216ce1820..64f024aac 100644
--- a/mpn/generic/toom22_mul.c
+++ b/mpn/generic/toom22_mul.c
@@ -202,7 +202,7 @@ mpn_toom22_mul (mp_ptr pp,
#if WANT_ASSERT
/* The borrow in cy stops the propagation of the carry cy2, */
ASSERT (cy2 == 1);
- cy += mpn_add_1 (pp + 2 * n, pp + 2 * n, n, 1);
+ cy += mpn_add_1 (pp + 2 * n, pp + 2 * n, n, cy2);
ASSERT (cy == 0);
#else
/* we simply fill the area with zeros. */
diff --git a/mpn/generic/toom2_sqr.c b/mpn/generic/toom2_sqr.c
index 7869f0fbd..4eaa1417a 100644
--- a/mpn/generic/toom2_sqr.c
+++ b/mpn/generic/toom2_sqr.c
@@ -145,7 +145,7 @@ mpn_toom2_sqr (mp_ptr pp,
#if WANT_ASSERT
/* The borrow in cy stops the propagation of the carry cy2, */
ASSERT (cy2 == 1);
- cy += mpn_add_1 (pp + 2 * n, pp + 2 * n, n, 1);
+ cy += mpn_add_1 (pp + 2 * n, pp + 2 * n, n, cy2);
ASSERT (cy == 0);
#else
/* we simply fill the area with zeros. */
diff --git a/mpn/generic/toom32_mul.c b/mpn/generic/toom32_mul.c
index 0c61abfb2..f03ba568f 100644
--- a/mpn/generic/toom32_mul.c
+++ b/mpn/generic/toom32_mul.c
@@ -104,7 +104,7 @@ mpn_toom32_mul (mp_ptr pp,
/* FIXME: Keep v1[2*n] and vm1[2*n] in scalar variables? */
- /* Compute ap1 = a0 + a1 + a3, am1 = a0 - a1 + a3 */
+ /* Compute ap1 = a0 + a1 + a2, am1 = a0 - a1 + a2 */
ap1_hi = mpn_add (ap1, a0, n, a2, s);
#if HAVE_NATIVE_mpn_add_n_sub_n
if (ap1_hi == 0 && mpn_cmp (ap1, a1, n) < 0)