[Gmp-commit] /var/hg/gmp: 4 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sat Nov 9 12:02:24 UTC 2019
details: /var/hg/gmp/rev/46b4c2e7f148
changeset: 17950:46b4c2e7f148
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Nov 09 12:46:43 2019 +0100
description:
mpn/generic/gcdext_1.c: remove non printable char from a comment
details: /var/hg/gmp/rev/1a3457f05526
changeset: 17951:1a3457f05526
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Nov 09 12:47:42 2019 +0100
description:
tune/speed*: add optional r flag for mpz_powm
details: /var/hg/gmp/rev/237af082b08e
changeset: 17952:237af082b08e
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Nov 09 12:48:46 2019 +0100
description:
mpz/millerrabin.c: Update limit for checked values
details: /var/hg/gmp/rev/8ac9028823d8
changeset: 17953:8ac9028823d8
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Nov 09 13:01:58 2019 +0100
description:
ChangeLog
diffstat:
ChangeLog | 5 +++++
mpn/generic/gcdext_1.c | 2 +-
mpz/millerrabin.c | 12 ++++++------
tune/speed.c | 2 +-
tune/speed.h | 5 ++++-
5 files changed, 17 insertions(+), 9 deletions(-)
diffs (73 lines):
diff -r ad871f73034e -r 8ac9028823d8 ChangeLog
--- a/ChangeLog Sat Nov 09 07:46:38 2019 +0100
+++ b/ChangeLog Sat Nov 09 13:01:58 2019 +0100
@@ -1,3 +1,8 @@
+2019-10-09 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * tune/speed.c (routine_t): Add R flago to mpz_powm
+ * tune/speed.h (SPEED_ROUTINE_MPZ_POWM): Use R flag as the base.
+
2019-10-02 Torbjörn Granlund <tg at gmplib.org>
* configure.ac: Make more path distinctions for the benefit of
diff -r ad871f73034e -r 8ac9028823d8 mpn/generic/gcdext_1.c
--- a/mpn/generic/gcdext_1.c Sat Nov 09 07:46:38 2019 +0100
+++ b/mpn/generic/gcdext_1.c Sat Nov 09 13:01:58 2019 +0100
@@ -237,7 +237,7 @@
ugh = ug/2 + (ug & 1);
vgh = vg/2 + (vg & 1);
- /* Now ±2^{shift} g = s0 U - t0 V. Get rid of the power of two, using
+ /* Now 2^{shift} g = s0 U - t0 V. Get rid of the power of two, using
s0 U - t0 V = (s0 + V/g) U - (t0 + U/g) V. */
for (i = 0; i < shift; i++)
{
diff -r ad871f73034e -r 8ac9028823d8 mpz/millerrabin.c
--- a/mpz/millerrabin.c Sat Nov 09 07:46:38 2019 +0100
+++ b/mpz/millerrabin.c Sat Nov 09 13:01:58 2019 +0100
@@ -101,12 +101,12 @@
|| SIZ (n) - 64 / GMP_NUMB_BITS == (PTR (n) [64 / GMP_NUMB_BITS] < CNST_LIMB(1) << 64 % GMP_NUMB_BITS)
#endif
#else
- /* Consider numbers up to 37*2^45 that pass the BPSW test as primes.
- This implementation was tested up to 37*2^45 = 2^50+2^47+2^45 */
- /* 2^5 < 37 = 0b100101 < 2^6 */
-#define GMP_BPSW_LIMB_CONST CNST_LIMB(37)
-#define GMP_BPSW_BITS_CONST (LOG2C(37) - 1)
-#define GMP_BPSW_BITS_LIMIT (45 + GMP_BPSW_BITS_CONST)
+ /* Consider numbers up to 19*2^46 that pass the BPSW test as primes.
+ This implementation was tested up to 19*2^46 = 2^50+2^47+2^46 */
+ /* 2^4 < 19 = 0b10011 < 2^5 */
+#define GMP_BPSW_LIMB_CONST CNST_LIMB(19)
+#define GMP_BPSW_BITS_CONST (LOG2C(19) - 1)
+#define GMP_BPSW_BITS_LIMIT (46 + GMP_BPSW_BITS_CONST)
#define GMP_BPSW_LIMBS_LIMIT (GMP_BPSW_BITS_LIMIT / GMP_NUMB_BITS)
#define GMP_BPSW_BITS_MOD (GMP_BPSW_BITS_LIMIT % GMP_NUMB_BITS)
diff -r ad871f73034e -r 8ac9028823d8 tune/speed.c
--- a/tune/speed.c Sat Nov 09 07:46:38 2019 +0100
+++ b/tune/speed.c Sat Nov 09 13:01:58 2019 +0100
@@ -417,7 +417,7 @@
{ "mpz_2fac_ui", speed_mpz_2fac_ui, FLAG_NODATA },
{ "mpz_mfac_uiui", speed_mpz_mfac_uiui, FLAG_NODATA | FLAG_R_OPTIONAL },
{ "mpz_primorial_ui", speed_mpz_primorial_ui, FLAG_NODATA },
- { "mpz_powm", speed_mpz_powm },
+ { "mpz_powm", speed_mpz_powm, FLAG_R_OPTIONAL },
{ "mpz_powm_mod", speed_mpz_powm_mod },
{ "mpz_powm_redc", speed_mpz_powm_redc },
{ "mpz_powm_sec", speed_mpz_powm_sec },
diff -r ad871f73034e -r 8ac9028823d8 tune/speed.h
--- a/tune/speed.h Sat Nov 09 07:46:38 2019 +0100
+++ b/tune/speed.h Sat Nov 09 13:01:58 2019 +0100
@@ -2638,7 +2638,10 @@
SPEED_RESTRICT_COND (s->size >= 1); \
\
mpz_init (r); \
- mpz_init_set_n (b, s->xp, s->size); \
+ if (s->r < 2) \
+ mpz_init_set_n (b, s->xp, s->size); \
+ else \
+ mpz_init_set_ui (b, s->r); \
mpz_init_set_n (m, s->yp, s->size); \
mpz_setbit (m, 0); /* force m to odd */ \
mpz_init_set_n (e, s->xp_block, 6); \
More information about the gmp-commit
mailing list