diff --git a/gmp-impl.h b/gmp-impl.h index a8d1bd1a..f11547cb 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -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 diff --git a/mpz/mul.c b/mpz/mul.c index f2f49833..e9ee4b11 100644 --- a/mpz/mul.c +++ b/mpz/mul.c @@ -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);