[Gmp-commit] /var/hg/gmp: mini-gmp: Fix mpz_clrbit normalization bug.

mercurial at gmplib.org mercurial at gmplib.org
Wed Aug 27 07:05:59 UTC 2014


details:   /var/hg/gmp/rev/33ff2f5edbef
changeset: 16479:33ff2f5edbef
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Aug 27 09:05:19 2014 +0200
description:
mini-gmp: Fix mpz_clrbit normalization bug.

diffstat:

 ChangeLog           |  5 +++++
 mini-gmp/mini-gmp.c |  2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 4aef3e5f408b -r 33ff2f5edbef ChangeLog
--- a/ChangeLog	Sat Aug 23 19:41:37 2014 +0200
+++ b/ChangeLog	Wed Aug 27 09:05:19 2014 +0200
@@ -1,3 +1,8 @@
+2014-08-27  Niels Möller  <nisse at lysator.liu.se>
+
+	* mini-gmp/mini-gmp.c (mpz_abs_sub_bit): Do full normalization,
+	needed if mpz_clrbit clears the most significant one bit.
+
 2014-08-23  Torbjörn Granlund  <tege at gmplib.org>
 
 	* mpn/arm64/bdiv_dbm1c.asm: New file.
diff -r 4aef3e5f408b -r 33ff2f5edbef mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Sat Aug 23 19:41:37 2014 +0200
+++ b/mini-gmp/mini-gmp.c	Wed Aug 27 09:05:19 2014 +0200
@@ -3553,7 +3553,7 @@
 
   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;
 }
 


More information about the gmp-commit mailing list