summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-24 17:49:46 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-24 17:49:46 +0100
commit0ae7141ee60286ca01fdbd01b21d608029310165 (patch)
treeec1f9ffaacf8790ae98fcfe2203058c7a9de98d4 /mpz
parent1dbb4385f235e12098424f707bfd5ceb7dcaa30a (diff)
downloadgmp-0ae7141ee60286ca01fdbd01b21d608029310165.tar.gz
mpz/nextprime.c: Update some comments.
Diffstat (limited to 'mpz')
-rw-r--r--mpz/nextprime.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mpz/nextprime.c b/mpz/nextprime.c
index a986058a0..5302f7c1a 100644
--- a/mpz/nextprime.c
+++ b/mpz/nextprime.c
@@ -109,7 +109,7 @@ calculate_sievelimit(mp_bitcnt_t nbits) {
}
else
{
- /* Larger threshold is faster but takes ~O(n/ln(n)) memory.
+ /* Larger threshold is faster but takes (n/ln(n) + n/24) memory.
* For 33,000 bits limitting to 150M is ~12% slower than using the
* optimal 1.5G sieve_limit.
*/
@@ -168,6 +168,10 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n)
up to the gap 304599508537+514=304599509051 .
With the current code our limit is 436273009+282=436273291 */
ASSERT (sieve_limit < 436273291);
+ /* THINK: Memory used by both sieve and primegap_tmp is kept
+ allocated, but they may overlap if primegap is filled from
+ larger down to smaller primes...
+ */
/* Needed to avoid assignment of read-only location */
primegap_tmp = TMP_ALLOC_TYPE (prime_limit, unsigned char);