[Gmp-commit] /home/hgfiles/gmp: Rename toom?h_sqr_itch to toom?h_mul_n_itch, ...

mercurial at gmplib.org mercurial at gmplib.org
Sat Dec 26 10:54:28 CET 2009


details:   /home/hgfiles/gmp/rev/3d7678257a01
changeset: 13222:3d7678257a01
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Dec 26 10:54:22 2009 +0100
description:
Rename toom?h_sqr_itch to toom?h_mul_n_itch, then use correct SQR thresholds.

diffstat:

 ChangeLog           |   6 ++++++
 gmp-impl.h          |  16 +++++++++++++---
 mpn/generic/mul_n.c |   4 ++--
 3 files changed, 21 insertions(+), 5 deletions(-)

diffs (77 lines):

diff -r fc63792c7ba5 -r 3d7678257a01 ChangeLog
--- a/ChangeLog	Fri Dec 25 22:14:43 2009 +0100
+++ b/ChangeLog	Sat Dec 26 10:54:22 2009 +0100
@@ -1,3 +1,9 @@
+2009-12-26  Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* gmp-impl.h (mpn_toom6_sqr_itch): Rename to mpn_toom6_mul_n_itch and redefine.
+	(mpn_toom8_sqr_itch): Rename to mpn_toom8_mul_n_itch and redefine.
+	* mpn/generic/mul_n.c: Use renamed _itch macros.
+
 2009-12-25  Niels Möller  <nisse at lysator.liu.se>
 
 	* tests/mpn/t-toom32.c (MIN_AN, MIN_BN, MAX_BN): Tightened requirements.
diff -r fc63792c7ba5 -r 3d7678257a01 gmp-impl.h
--- a/gmp-impl.h	Fri Dec 25 22:14:43 2009 +0100
+++ b/gmp-impl.h	Sat Dec 26 10:54:22 2009 +0100
@@ -4491,6 +4491,11 @@
   (3 * (an) + GMP_NUMB_BITS)
 
 #define mpn_toom6_sqr_itch(n)						\
+( ((n) - SQR_TOOM6_THRESHOLD)*2 +					\
+   MAX(SQR_TOOM6_THRESHOLD*2 + GMP_NUMB_BITS*6,			\
+       mpn_toom4_sqr_itch(SQR_TOOM6_THRESHOLD)) )
+
+#define mpn_toom6_mul_n_itch(n)						\
 ( ((n) - MUL_TOOM6H_THRESHOLD)*2 +					\
    MAX(MUL_TOOM6H_THRESHOLD*2 + GMP_NUMB_BITS*6,			\
        mpn_toom44_mul_itch(MUL_TOOM6H_THRESHOLD,MUL_TOOM6H_THRESHOLD)) )
@@ -4499,19 +4504,24 @@
 mpn_toom6h_mul_itch (mp_size_t an, mp_size_t bn) {
   mp_size_t estimatedN;
   estimatedN = (an + bn) / (size_t) 10 + 1;
-  return mpn_toom6_sqr_itch (estimatedN * 6);
+  return mpn_toom6_mul_n_itch (estimatedN * 6);
 }
 
 #define mpn_toom8_sqr_itch(n)						\
+( (((n)*15)>>3) - ((SQR_TOOM8_THRESHOLD*15)>>3) +			\
+   MAX(((SQR_TOOM8_THRESHOLD*15)>>3) + GMP_NUMB_BITS*6,		\
+       mpn_toom6_sqr_itch(SQR_TOOM8_THRESHOLD)) )
+
+#define mpn_toom8_mul_n_itch(n)						\
 ( (((n)*15)>>3) - ((MUL_TOOM8H_THRESHOLD*15)>>3) +			\
    MAX(((MUL_TOOM8H_THRESHOLD*15)>>3) + GMP_NUMB_BITS*6,		\
-       mpn_toom6_sqr_itch(MUL_TOOM8H_THRESHOLD)) )
+       mpn_toom6_mul_n_itch(MUL_TOOM8H_THRESHOLD)) )
 
 static inline mp_size_t
 mpn_toom8h_mul_itch (mp_size_t an, mp_size_t bn) {
   mp_size_t estimatedN;
   estimatedN = (an + bn) / (size_t) 14 + 1;
-  return mpn_toom8_sqr_itch (estimatedN * 8);
+  return mpn_toom8_mul_n_itch (estimatedN * 8);
 }
 
 static inline mp_size_t
diff -r fc63792c7ba5 -r 3d7678257a01 mpn/generic/mul_n.c
--- a/mpn/generic/mul_n.c	Fri Dec 25 22:14:43 2009 +0100
+++ b/mpn/generic/mul_n.c	Sat Dec 26 10:54:22 2009 +0100
@@ -64,7 +64,7 @@
       mp_ptr ws;
       TMP_SDECL;
       TMP_SMARK;
-      ws = TMP_SALLOC_LIMBS (mpn_toom6_sqr_itch (n));
+      ws = TMP_SALLOC_LIMBS (mpn_toom6_mul_n_itch (n));
       mpn_toom6h_mul (p, a, n, b, n, ws);
       TMP_SFREE;
     }
@@ -73,7 +73,7 @@
       mp_ptr ws;
       TMP_DECL;
       TMP_MARK;
-      ws = TMP_ALLOC_LIMBS (mpn_toom8_sqr_itch (n));
+      ws = TMP_ALLOC_LIMBS (mpn_toom8_mul_n_itch (n));
       mpn_toom8h_mul (p, a, n, b, n, ws);
       TMP_FREE;
     }


More information about the gmp-commit mailing list