summaryrefslogtreecommitdiff
path: root/mini-gmp
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2020-10-18 07:43:00 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2020-10-18 07:43:00 +0200
commit51e17eb02d73148f9a67853290a976fbddff9c41 (patch)
tree2e1dc8fce56dd2bd0341d9a55fec8b61680e1109 /mini-gmp
parentb8d780cef37d7f5d396029f1e380bfab3ab69489 (diff)
downloadgmp-51e17eb02d73148f9a67853290a976fbddff9c41.tar.gz
mini-gmp/mini-gmp.c (mpz_gcdext): Delay mpz_setbit (t0, ...).
Diffstat (limited to 'mini-gmp')
-rw-r--r--mini-gmp/mini-gmp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mini-gmp/mini-gmp.c b/mini-gmp/mini-gmp.c
index a78264533..65735d98a 100644
--- a/mini-gmp/mini-gmp.c
+++ b/mini-gmp/mini-gmp.c
@@ -2868,7 +2868,6 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
* s0 = 0, s1 = 2^vz
*/
- mpz_setbit (t0, uz);
mpz_tdiv_qr (t1, tu, tu, tv);
mpz_mul_2exp (t1, t1, uz);
@@ -2879,8 +2878,7 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
{
mp_bitcnt_t shift;
shift = mpz_make_odd (tu);
- mpz_mul_2exp (t0, t0, shift);
- mpz_mul_2exp (s0, s0, shift);
+ mpz_setbit (t0, uz + shift);
power += shift;
for (;;)
@@ -2918,6 +2916,8 @@ mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
power += shift;
}
}
+ else
+ mpz_setbit (t0, uz);
/* Now tv = odd part of gcd, and -s0 and t0 are corresponding
cofactors. */