summaryrefslogtreecommitdiff
path: root/primesieve.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2022-01-05 18:19:17 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2022-01-05 18:19:17 +0100
commit8bc636d74baf89c5edf02501ea478588623a3750 (patch)
tree69b7c3375d1f7e273e967fd0315de3c8d480656f /primesieve.c
parent80f8687c11422ed3cbf82f5202a40f8cf9b80940 (diff)
downloadgmp-8bc636d74baf89c5edf02501ea478588623a3750.tar.gz
gen-sieve.c: Generate at compile-time masks used by primesieve.c .
Diffstat (limited to 'primesieve.c')
-rw-r--r--primesieve.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/primesieve.c b/primesieve.c
index 2a33add64..567fab0f5 100644
--- a/primesieve.c
+++ b/primesieve.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, 2016, 2021 Free Software Foundation, Inc.
+Copyright 2010-2012, 2015, 2016, 2021, 2022 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -59,23 +59,6 @@ static mp_size_t
primesieve_size (mp_limb_t n) { return n_fto_bit(n) / GMP_LIMB_BITS + 1; }
#endif
-#if GMP_LIMB_BITS == 64
-/* 110bits pre-sieved mask for primes 5, 11*/
-#define SIEVE_MASK1 CNST_LIMB(0x81214a1204892058)
-#define SIEVE_MASKT CNST_LIMB(0xc8130681244)
-/* 182bits pre-sieved mask for primes 7, 13*/
-#define SIEVE_2MSK1 CNST_LIMB(0x9402180c40230184)
-#define SIEVE_2MSK2 CNST_LIMB(0x0285021088402120)
-#define SIEVE_2MSKT CNST_LIMB(0xa41210084421)
-#endif
-
-#if GMP_LIMB_BITS == 32
-/* 70bits pre-sieved mask for primes 5, 7*/
-#define SIEVE_MASK1 CNST_LIMB(0x12148960)
-#define SIEVE_MASK2 CNST_LIMB(0x44a120cc)
-#define SIEVE_MASKT CNST_LIMB(0x1a)
-#endif
-
#define SET_OFF1(m1, m2, M1, M2, off, BITS) \
if (off) { \
if (off < GMP_LIMB_BITS) { \
@@ -218,11 +201,10 @@ block_resieve (mp_ptr bit_array, mp_size_t limbs, mp_limb_t offset,
mp_limb_t mask, i;
ASSERT (limbs > 0);
- ASSERT (offset >= GMP_LIMB_BITS);
bits = limbs * GMP_LIMB_BITS - 1;
- i = fill_bitpattern (bit_array, limbs, offset - GMP_LIMB_BITS);
+ i = fill_bitpattern (bit_array, limbs, offset);
ASSERT (i < GMP_LIMB_BITS);