[Gmp-commit] /home/hgfiles/gmp: Handle thershold == zero in TOOMxH_itch.

mercurial at gmplib.org mercurial at gmplib.org
Sat Feb 5 01:01:10 CET 2011


details:   /home/hgfiles/gmp/rev/1b0be85a44f3
changeset: 13825:1b0be85a44f3
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Feb 05 01:00:57 2011 +0100
description:
Handle thershold == zero in TOOMxH_itch.

diffstat:

 ChangeLog  |   5 +++++
 gmp-impl.h |  20 +++++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r d55a50914ecc -r 1b0be85a44f3 ChangeLog
--- a/ChangeLog	Fri Feb 04 17:58:35 2011 +0100
+++ b/ChangeLog	Sat Feb 05 01:00:57 2011 +0100
@@ -1,3 +1,8 @@
+2011-02-05 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* gmp-impl.h (mpn_toom6_mul_n_itch): Handle threshold == zero.
+	 (mpn_toom8_mul_n_itch): Likewise.
+
 2011-02-04  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/x86_64/atom/rsh1aors_n.asm: Add a MULFUNC_PROLOGUE.
diff -r d55a50914ecc -r 1b0be85a44f3 gmp-impl.h
--- a/gmp-impl.h	Fri Feb 04 17:58:35 2011 +0100
+++ b/gmp-impl.h	Sat Feb 05 01:00:57 2011 +0100
@@ -4620,13 +4620,16 @@
 
 #define mpn_toom6_sqr_itch(n)						\
 ( ((n) - SQR_TOOM6_THRESHOLD)*2 +					\
-   MAX(SQR_TOOM6_THRESHOLD*2 + GMP_NUMB_BITS*6,			\
+   MAX(SQR_TOOM6_THRESHOLD*2 + GMP_NUMB_BITS*6,				\
        mpn_toom4_sqr_itch(SQR_TOOM6_THRESHOLD)) )
 
+#define MUL_TOOM6H_MIN							\
+  ((MUL_TOOM6H_THRESHOLD > MUL_TOOM44_THRESHOLD) ?			\
+    MUL_TOOM6H_THRESHOLD : MUL_TOOM44_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)) )
+( ((n) - MUL_TOOM6H_MIN)*2 +					\
+   MAX(MUL_TOOM6H_MIN*2 + GMP_NUMB_BITS*6,			\
+       mpn_toom44_mul_itch(MUL_TOOM6H_MIN,MUL_TOOM6H_MIN)) )
 
 static inline mp_size_t
 mpn_toom6h_mul_itch (mp_size_t an, mp_size_t bn) {
@@ -4640,10 +4643,13 @@
    MAX(((SQR_TOOM8_THRESHOLD*15)>>3) + GMP_NUMB_BITS*6,		\
        mpn_toom6_sqr_itch(SQR_TOOM8_THRESHOLD)) )
 
+#define MUL_TOOM8H_MIN							\
+  ((MUL_TOOM8H_THRESHOLD > MUL_TOOM6H_MIN) ?				\
+    MUL_TOOM8H_THRESHOLD : MUL_TOOM6H_MIN)
 #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_mul_n_itch(MUL_TOOM8H_THRESHOLD)) )
+( (((n)*15)>>3) - ((MUL_TOOM8H_MIN*15)>>3) +			\
+   MAX(((MUL_TOOM8H_MIN*15)>>3) + GMP_NUMB_BITS*6,		\
+       mpn_toom6_mul_n_itch(MUL_TOOM8H_MIN)) )
 
 static inline mp_size_t
 mpn_toom8h_mul_itch (mp_size_t an, mp_size_t bn) {


More information about the gmp-commit mailing list