Added some further default cutoffs and fixed a bug in mpz/mul.c.

This commit is contained in:
(no author) 2010-03-23 15:25:04 +00:00
parent f4f8dea3a4
commit 947c002017
2 changed files with 18 additions and 0 deletions

View File

@ -1524,6 +1524,10 @@ __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[];
#define MUL_KARATSUBA_THRESHOLD 32
#endif
#ifndef SQR_KARATSUBA_THRESHOLD
#define SQR_KARATSUBA_THRESHOLD 32
#endif
/* If MUL_TOOM3_THRESHOLD is not already defined, define it to a
value which is good on most machines. */
#ifndef MUL_TOOM3_THRESHOLD
@ -1542,6 +1546,18 @@ __GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[];
#define MUL_TOOM8H_THRESHOLD 401
#endif
#ifndef SQR_TOOM3_THRESHOLD
#define SQR_TOOM3_THRESHOLD 128
#endif
#ifndef SQR_TOOM4_THRESHOLD
#define SQR_TOOM4_THRESHOLD 300
#endif
#ifndef SQR_TOOM8_THRESHOLD
#define SQR_TOOM8_THRESHOLD 401
#endif
#ifndef MULLOW_BASECASE_THRESHOLD
#define MULLOW_BASECASE_THRESHOLD 8
#endif

View File

@ -94,9 +94,11 @@ mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w)
wp = PTR(w);
if (usize == vsize)
{
#if HAVE_NATIVE_mpn_sqr_basecase
if (PTR(u) == PTR(v))
mpn_sqr_basecase(wp, PTR(u), usize);
else
#endif
mpn_mul_basecase(wp, PTR(u), usize, PTR(v), vsize);
} else if (usize > vsize)
mpn_mul_basecase(wp, PTR(u), usize, PTR(v), vsize);