[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Fri Sep 20 18:46:30 UTC 2019
details: /var/hg/gmp/rev/0688aef1f7e3
changeset: 17919:0688aef1f7e3
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Fri Sep 20 20:35:11 2019 +0200
description:
tests/mpn/t-sqrlo.c: Initialise scratch area.
details: /var/hg/gmp/rev/3e04a9bbba13
changeset: 17920:3e04a9bbba13
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Fri Sep 20 20:36:30 2019 +0200
description:
mpz/primorial_ui.c: Compress table in a 15-bit constant.
diffstat:
mpz/primorial_ui.c | 10 ++++------
tests/mpn/t-sqrlo.c | 2 --
2 files changed, 4 insertions(+), 8 deletions(-)
diffs (51 lines):
diff -r 33f3a1eafa88 -r 3e04a9bbba13 mpz/primorial_ui.c
--- a/mpz/primorial_ui.c Wed Sep 18 23:50:51 2019 +0200
+++ b/mpz/primorial_ui.c Fri Sep 20 20:36:30 2019 +0200
@@ -108,13 +108,11 @@
void
mpz_primorial_ui (mpz_ptr x, unsigned long n)
{
- static const mp_limb_t table[] = { 1, 1, 2, 6, 6 };
-
ASSERT (n <= GMP_NUMB_MAX);
- if (n < numberof (table))
+ if (n < 5)
{
- MPZ_NEWALLOC (x, 1)[0] = table[n];
+ MPZ_NEWALLOC (x, 1)[0] = (066211 >> (n*3)) & 7;
SIZ (x) = 1;
}
else
@@ -135,7 +133,7 @@
j = 0;
- prod = table[numberof (table)-1];
+ prod = 6;
/* Store primes from 5 to n */
{
@@ -143,7 +141,7 @@
max_prod = GMP_NUMB_MAX / n;
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit(numberof (table)), n_to_bit (n), 0, sieve);
+ LOOP_ON_SIEVE_BEGIN (prime, n_to_bit(5), n_to_bit (n), 0, sieve);
FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
LOOP_ON_SIEVE_END;
}
diff -r 33f3a1eafa88 -r 3e04a9bbba13 tests/mpn/t-sqrlo.c
--- a/tests/mpn/t-sqrlo.c Wed Sep 18 23:50:51 2019 +0200
+++ b/tests/mpn/t-sqrlo.c Fri Sep 20 20:36:30 2019 +0200
@@ -83,10 +83,8 @@
p_after = pp[n];
itch = mpn_sqrlo_itch (n);
-#if 0
ASSERT_ALWAYS (itch <= mpn_sqrlo_itch (MAX_N));
mpn_random2 (scratch-1, itch+2);
-#endif
s_before = scratch[-1];
s_after = scratch[itch];
More information about the gmp-commit
mailing list