summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--mini-gmp.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b0f67df..ce820fc8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-26 Niels Möller <nisse@lysator.liu.se>
+
+ * mini-gmp.c (mpz_abs_sub_bit): Do full normalization, needed in
+ case the most significant bit is cleared.
+
2014-08-25 Niels Möller <nisse@lysator.liu.se>
* testsuite/ecdh-test.c (set_point): Check return value of
diff --git a/mini-gmp.c b/mini-gmp.c
index b9186951..acbe1bec 100644
--- a/mini-gmp.c
+++ b/mini-gmp.c
@@ -3569,7 +3569,7 @@ mpz_abs_sub_bit (mpz_t d, mp_bitcnt_t bit_index)
gmp_assert_nocarry (mpn_sub_1 (dp + limb_index, dp + limb_index,
dn - limb_index, bit));
- dn -= (dp[dn-1] == 0);
+ dn = mpn_normalized_size (dp, dn);
d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
}