summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2021-11-11 21:34:10 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2021-11-11 21:34:10 +0100
commiteaef91df4a2e533fad5a2646e9f5d4fd0e9b2d19 (patch)
tree6e65cb03f3b7e2b2c677e17a2428bf3054dad9dd /mpz
parentb192f23b27ea590d3b402568f83cbb9b47a3022f (diff)
downloadgmp-eaef91df4a2e533fad5a2646e9f5d4fd0e9b2d19.tar.gz
mpz/oddfac_1.c (FACTORS_PER_LIMB): Estimate conservatively
Diffstat (limited to 'mpz')
-rw-r--r--mpz/oddfac_1.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mpz/oddfac_1.c b/mpz/oddfac_1.c
index 9a20ba4ac..0e9443f8d 100644
--- a/mpz/oddfac_1.c
+++ b/mpz/oddfac_1.c
@@ -7,7 +7,7 @@ IT IS ONLY SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.
IN FACT, IT IS ALMOST GUARANTEED THAT IT WILL CHANGE OR
DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2010-2012, 2015-2017, 2020 Free Software Foundation, Inc.
+Copyright 2010-2012, 2015-2017, 2020, 2021 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -257,10 +257,12 @@ mpz_2multiswing_1 (mpz_ptr x, mp_limb_t n, mp_ptr sieve, mp_ptr factors)
/* Section oddfac: odd factorial, needed also by binomial*/
/*********************************************************/
+/* FIXME: refine che following estimate. */
+
#if TUNE_PROGRAM_BUILD
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD_LIMIT*FAC_DSC_THRESHOLD_LIMIT-1)+1) * 2)
+#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD_LIMIT*FAC_DSC_THRESHOLD_LIMIT-1)+1) * 2 - 1)
#else
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD*FAC_DSC_THRESHOLD-1)+1) * 2)
+#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD*FAC_DSC_THRESHOLD-1)+1) * 2 - 1)
#endif
/* mpz_oddfac_1 computes the odd part of the factorial of the