diff options
author | tege <tege@gmplib.org> | 1999-09-28 17:44:18 +0200 |
---|---|---|
committer | tege <tege@gmplib.org> | 1999-09-28 17:44:18 +0200 |
commit | 00ede29d45a0acd8d2cb4357f5c799a0158d1c44 (patch) | |
tree | 2149afa82ffb27b4b1a40112e3549406bf6629fd /mpz/setbit.c | |
parent | a64ccae796808135540f1938c6d0ae98258cbe06 (diff) | |
download | gmp-00ede29d45a0acd8d2cb4357f5c799a0158d1c44.tar.gz |
Use mpn_incr_u and mpn_decr_u instead of mpn_add_1 and mpn_sub_1.
Diffstat (limited to 'mpz/setbit.c')
-rw-r--r-- | mpz/setbit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mpz/setbit.c b/mpz/setbit.c index 6bd80a273..76ac6fa67 100644 --- a/mpz/setbit.c +++ b/mpz/setbit.c @@ -63,7 +63,7 @@ mpz_setbit (d, bit_index) /* Simulate two's complement arithmetic, i.e. simulate 1. Set OP = ~(OP - 1) [with infinitely many leading ones]. - 2. set the bit. + 2. Set the bit. 3. Set OP = ~OP + 1. */ dsize = -dsize; @@ -109,7 +109,7 @@ mpz_setbit (d, bit_index) } else { - mpn_sub_1 (dp + limb_index, dp + limb_index, dsize - limb_index, + mpn_decr_u (dp + limb_index, (mp_limb_t) 1 << (bit_index % BITS_PER_MP_LIMB)); dsize -= dp[dsize - 1] == 0; d->_mp_size = -dsize; |