diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2020-02-02 16:04:20 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2020-02-02 16:04:20 +0100 |
commit | 5ead74d9fdf9234a14262efd4ddda13ee123602a (patch) | |
tree | 605f08734fc1d40f4cb2947377c4d814ae27b380 /mini-gmp/mini-gmp.c | |
parent | 1cf0953cc49dc155939434b5b15d11acc21c1687 (diff) | |
download | gmp-5ead74d9fdf9234a14262efd4ddda13ee123602a.tar.gz |
mini-gmp/mini-gmp.c (gmp_jacobi_coprime): Exit condition on a.
Diffstat (limited to 'mini-gmp/mini-gmp.c')
-rw-r--r-- | mini-gmp/mini-gmp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mini-gmp/mini-gmp.c b/mini-gmp/mini-gmp.c index 2e789a2df..66cc84625 100644 --- a/mini-gmp/mini-gmp.c +++ b/mini-gmp/mini-gmp.c @@ -3357,6 +3357,8 @@ gmp_jacobi_coprime (mp_limb_t a, mp_limb_t b) bit ^= c & (b ^ (b >> 1)); if (a < b) { + if (a == 0) + return bit & 1 ? -1 : 1; bit ^= a & b; a = b - a; b -= a; @@ -3370,9 +3372,7 @@ gmp_jacobi_coprime (mp_limb_t a, mp_limb_t b) gmp_ctz(c, a); ++c; } - while (b > 0); - - return bit & 1 ? -1 : 1; + while (1); } static void |