diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-03-14 22:59:01 +0100 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-03-14 22:59:01 +0100 |
commit | 0d26cdda31ceebaf18de0c7e86bdbc51080ca157 (patch) | |
tree | 57071c931df3eba8ba76ceaa102906054244c031 /mpz/setbit.c | |
parent | 4750f622ce26742e49462649ad9abfa971030988 (diff) | |
download | gmp-0d26cdda31ceebaf18de0c7e86bdbc51080ca157.tar.gz |
* mpz/setbit.c: Fix normalization for case of a negative ending up
with a zero high limb.
Diffstat (limited to 'mpz/setbit.c')
-rw-r--r-- | mpz/setbit.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mpz/setbit.c b/mpz/setbit.c index dcb3a6731..bce208792 100644 --- a/mpz/setbit.c +++ b/mpz/setbit.c @@ -72,9 +72,11 @@ mpz_setbit (mpz_ptr d, unsigned long int bit_index) if (limb_index > zero_bound) { if (limb_index < dsize) - dp[limb_index] &= ~((mp_limb_t) 1 << (bit_index % BITS_PER_MP_LIMB)); - else - ; + { + dp[limb_index] &= ~((mp_limb_t) 1 << (bit_index % BITS_PER_MP_LIMB)); + MPN_NORMALIZE (dp, dsize); + d->_mp_size = -dsize; + } } else if (limb_index == zero_bound) { |