[Gmp-commit] /var/hg/gmp: mpz/stronglucas.c: Add a comment
mercurial at gmplib.org
mercurial at gmplib.org
Sun May 29 18:20:49 CEST 2022
details: /var/hg/gmp/rev/58bb9b017366
changeset: 18361:58bb9b017366
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sun May 29 18:08:56 2022 +0200
description:
mpz/stronglucas.c: Add a comment
diffstat:
mpz/stronglucas.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r 61ef108d740c -r 58bb9b017366 mpz/stronglucas.c
--- a/mpz/stronglucas.c Sun May 29 16:16:47 2022 +0200
+++ b/mpz/stronglucas.c Sun May 29 18:08:56 2022 +0200
@@ -122,6 +122,7 @@
/* (2^24 - 1) | (2^{GMP_NUMB_BITS*3/4} - 1) */
/* (2^24 - 1) = (2^12 - 1) * 17 * 241 */
else if (! POW2_P (g % 17) && ! POW2_P (17 - g % 17))
+ /* (17/n) = -1, iff n != +-1,+-2,+-4,+-8 (mod 17) */
D = 17; /* Q = -4 */
#endif
#else
@@ -179,7 +180,7 @@
/* If Ud != 0 && Vd != 0 */
if (mpz_lucas_mod (V, Qk, Q, b0, n, T1, T2) == 0)
if (LIKELY (--b0 != 0))
- do
+ for (;;)
{
/* V_{2k} <- V_k ^ 2 - 2Q^k */
mpz_mul (T2, V, V);
@@ -190,7 +191,7 @@
/* Q^{2k} = (Q^k)^2 */
mpz_mul (T2, Qk, Qk);
mpz_tdiv_r (Qk, T2, n);
- } while (1);
+ }
mpz_clear (T1);
mpz_clear (T2);
More information about the gmp-commit
mailing list