[Gmp-commit] /var/hg/gmp: Make toom63 handle slightly more unbalanced operands.
mercurial at gmplib.org
mercurial at gmplib.org
Thu Feb 2 20:21:31 CET 2012
details: /var/hg/gmp/rev/e04ccb360d9d
changeset: 14599:e04ccb360d9d
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 02 20:21:25 2012 +0100
description:
Make toom63 handle slightly more unbalanced operands.
diffstat:
ChangeLog | 3 +++
mpn/generic/toom63_mul.c | 6 +++---
mpn/generic/toom_interpolate_8pts.c | 5 ++++-
3 files changed, 10 insertions(+), 4 deletions(-)
diffs (48 lines):
diff -r 06f73698942f -r e04ccb360d9d ChangeLog
--- a/ChangeLog Thu Feb 02 14:18:32 2012 +0100
+++ b/ChangeLog Thu Feb 02 20:21:25 2012 +0100
@@ -1,5 +1,8 @@
2012-02-02 Torbjorn Granlund <tege at gmplib.org>
+ * mpn/generic/toom63_mul.c: Allow s+t==n by adjusting an ASSERT.
+ * mpn/generic/toom_interpolate_8pts.c: Perform final incr iff s+t!=n.
+
* tests/mpn/t-toom6h.c (MIN_BN): Make more consistent with ASSERT in
tested function.
diff -r 06f73698942f -r e04ccb360d9d mpn/generic/toom63_mul.c
--- a/mpn/generic/toom63_mul.c Thu Feb 02 14:18:32 2012 +0100
+++ b/mpn/generic/toom63_mul.c Thu Feb 02 20:21:25 2012 +0100
@@ -6,7 +6,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 2009 Free Software Foundation, Inc.
+Copyright 2009, 2012 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -105,8 +105,8 @@
ASSERT (0 < s && s <= n);
ASSERT (0 < t && t <= n);
- /* WARNING! it assumes s+t>n */
- ASSERT ( s + t > n );
+ /* WARNING! it assumes s+t>=n */
+ ASSERT ( s + t >= n );
ASSERT ( s + t > 4);
/* WARNING! it assumes n>1 */
ASSERT ( n > 2);
diff -r 06f73698942f -r e04ccb360d9d mpn/generic/toom_interpolate_8pts.c
--- a/mpn/generic/toom_interpolate_8pts.c Thu Feb 02 14:18:32 2012 +0100
+++ b/mpn/generic/toom_interpolate_8pts.c Thu Feb 02 20:21:25 2012 +0100
@@ -194,5 +194,8 @@
cy = mpn_add_1 (pp + 6*n, r3 + n, n, pp[6*n]);
MPN_INCR_U (r3 + 2*n, n + 1, cy);
cy = r3[3*n] + mpn_add_n (pp + 7*n, pp + 7*n, r3 + 2*n, n);
- MPN_INCR_U (pp + 8*n, spt - n, cy);
+ if (LIKELY(spt != n))
+ MPN_INCR_U (pp + 8*n, spt - n, cy);
+ else
+ ASSERT (cy == 0);
}
More information about the gmp-commit
mailing list