summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-15 18:26:21 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-15 18:26:21 +0100
commitc07e396277eab29d644a37f02b2fdcfbc4b68b1c (patch)
tree7c9f4e07a59b64247cfcd6608376bde5de5a7b5b /tests
parent12d31d5fab8cce52120519328f844f7f5536c0c3 (diff)
downloadgmp-c07e396277eab29d644a37f02b2fdcfbc4b68b1c.tar.gz
: Use one less variable to loop on primes.
Diffstat (limited to 'tests')
-rw-r--r--tests/devel/primes.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/devel/primes.c b/tests/devel/primes.c
index 84b3b5117..e14fcc748 100644
--- a/tests/devel/primes.c
+++ b/tests/devel/primes.c
@@ -68,31 +68,31 @@ primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
/* Section macros: common macros, for swing/fac/bin (&sieve) */
/*************************************************************/
-#define LOOP_ON_SIEVE_CONTINUE(prime,end,sieve) \
+#define LOOP_ON_SIEVE_CONTINUE(prime,end) \
__max_i = (end); \
\
do { \
++__i; \
- if (((sieve)[__index] & __mask) == 0) \
+ if ((*__sieve & __mask) == 0) \
{ \
- mp_limb_t prime; \
+ mp_limb_t prime; \
prime = id_to_n(__i)
#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
do { \
- mp_limb_t __mask, __index, __max_i, __i; \
+ mp_limb_t __mask, *__sieve, __max_i, __i; \
\
__i = (start)-(off); \
- __index = __i / GMP_LIMB_BITS; \
+ __sieve = (sieve) + __i / GMP_LIMB_BITS; \
__mask = CNST_LIMB(1) << (__i % GMP_LIMB_BITS); \
__i += (off); \
\
- LOOP_ON_SIEVE_CONTINUE(prime,end,sieve)
+ LOOP_ON_SIEVE_CONTINUE(prime,end)
#define LOOP_ON_SIEVE_STOP \
} \
__mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
- __index += __mask & 1; \
+ __sieve += __mask & 1; \
} while (__i <= __max_i)
#define LOOP_ON_SIEVE_END \