[Gmp-commit] /var/hg/gmp: tests/mpn/t-toom8h.c: Don't use GMP_NUMB_BITS when ...

mercurial at gmplib.org mercurial at gmplib.org
Tue May 22 07:51:34 CEST 2012


details:   /var/hg/gmp/rev/8b7baba38e9b
changeset: 14995:8b7baba38e9b
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue May 22 07:51:15 2012 +0200
description:
tests/mpn/t-toom8h.c: Don't use GMP_NUMB_BITS when undefined.

diffstat:

 ChangeLog                |   2 ++
 mpn/generic/toom8h_mul.c |   9 ++++-----
 tests/mpn/t-toom8h.c     |  18 +++++-------------
 3 files changed, 11 insertions(+), 18 deletions(-)

diffs (59 lines):

diff -r 52db93244349 -r 8b7baba38e9b ChangeLog
--- a/ChangeLog	Mon May 21 22:11:57 2012 +0200
+++ b/ChangeLog	Tue May 22 07:51:15 2012 +0200
@@ -3,6 +3,8 @@
 	* mpn/generic/toom8_sqr.c: Reduce branches for recursion.
 	* mpn/generic/toom8h_mul.c: Likewise.
 
+	* tests/mpn/t-toom8h.c: Don't use GMP_NUMB_BITS when undefined.
+
 2012-05-20  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tests/mpz/t-gcd.c: Rewrite.
diff -r 52db93244349 -r 8b7baba38e9b mpn/generic/toom8h_mul.c
--- a/mpn/generic/toom8h_mul.c	Mon May 21 22:11:57 2012 +0200
+++ b/mpn/generic/toom8h_mul.c	Tue May 22 07:51:15 2012 +0200
@@ -117,11 +117,10 @@
   /* Can not handle too small operands */
   ASSERT (bn >= 86);
   /* Can not handle too much unbalancement */
-  ASSERT (an*4 <= bn*13);
-  ASSERT (GMP_NUMB_BITS > 12*3 || an*4 <= bn*12);
-  ASSERT (GMP_NUMB_BITS > 11*3 || an*5 <= bn*11);
-  ASSERT (GMP_NUMB_BITS > 10*3 || an*6 <= bn*10);
-  ASSERT (GMP_NUMB_BITS >  9*3 || an*7 <= bn* 9);
+  ASSERT (an <= bn*4);
+  ASSERT (GMP_NUMB_BITS > 11*3 || an*4 <= bn*11);
+  ASSERT (GMP_NUMB_BITS > 10*3 || an*1 <= bn* 2);
+  ASSERT (GMP_NUMB_BITS >  9*3 || an*2 <= bn* 3);
 
   /* Limit num/den is a rational number between
      (16/15)^(log(6)/log(2*6-1)) and (16/15)^(log(8)/log(2*8-1))             */
diff -r 52db93244349 -r 8b7baba38e9b tests/mpn/t-toom8h.c
--- a/tests/mpn/t-toom8h.c	Mon May 21 22:11:57 2012 +0200
+++ b/tests/mpn/t-toom8h.c	Tue May 22 07:51:15 2012 +0200
@@ -7,19 +7,11 @@
    toom{22,33,44,6h}_mul with invalid input size. */
 #define MIN_AN MUL_TOOM8H_MIN
 
-#if GMP_NUMB_BITS <= 10*3
-#define MIN_BN(an) (MAX ((an*6)/10, 86) )
-#else
-#if GMP_NUMB_BITS <= 11*3
-#define MIN_BN(an) (MAX ((an*5)/11, 86) )
-#else
-#if GMP_NUMB_BITS <= 12*3
-#define MIN_BN(an) (MAX ((an*4)/12, 86) )
-#else
-#define MIN_BN(an) (MAX ((an*4)/13, 86) )
-#endif
-#endif
-#endif
+#define MIN_BN(an)			 \
+(MAX(GMP_NUMB_BITS <= 10*3 ? (an*6)/10 : \
+     GMP_NUMB_BITS <= 11*3 ? (an*5)/11 : \
+     GMP_NUMB_BITS <= 12*3 ? (an*4)/12 : \
+     (an*4)/13, 86) )
 
 #define COUNT 1000
 


More information about the gmp-commit mailing list