diff options
author | Kevin Ryde <user42@zip.com.au> | 2002-04-16 23:30:57 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2002-04-16 23:30:57 +0200 |
commit | 4e61873373f96216b49f3875b81506d659788e0b (patch) | |
tree | b8429f954432144ed6e5550caa0151f86a056370 /mpn | |
parent | b86fb9fcd8c171a164fb51425503ce37fa9d4b38 (diff) | |
download | gmp-4e61873373f96216b49f3875b81506d659788e0b.tar.gz |
* mpn/generic/scan0.c, mpn/generic/scan1.c: Nailify.
Diffstat (limited to 'mpn')
-rw-r--r-- | mpn/generic/scan0.c | 14 | ||||
-rw-r--r-- | mpn/generic/scan1.c | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/mpn/generic/scan0.c b/mpn/generic/scan0.c index bd024e5b6..b7a0c5932 100644 --- a/mpn/generic/scan0.c +++ b/mpn/generic/scan0.c @@ -1,6 +1,6 @@ /* mpn_scan0 -- Scan from a given bit position for the next clear bit. -Copyright 1994, 1996, 2001 Free Software Foundation, Inc. +Copyright 1994, 1996, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -41,16 +41,16 @@ mpn_scan0 (register mp_srcptr up, mp_srcptr p; /* Start at the word implied by STARTING_BIT. */ - starting_word = starting_bit / BITS_PER_MP_LIMB; + starting_word = starting_bit / GMP_NUMB_BITS; p = up + starting_word; - alimb = ~*p++; + alimb = *p++ ^ GMP_NUMB_MASK; /* Mask off any bits before STARTING_BIT in the first limb. */ - alimb &= - (mp_limb_t) 1 << (starting_bit % BITS_PER_MP_LIMB); + alimb &= - (mp_limb_t) 1 << (starting_bit % GMP_NUMB_BITS); while (alimb == 0) - alimb = ~*p++; + alimb = *p++ ^ GMP_NUMB_MASK; - count_leading_zeros (cnt, alimb & -alimb); - return (p - up) * BITS_PER_MP_LIMB - 1 - cnt; + count_trailing_zeros (cnt, alimb); + return (p - up - 1) * GMP_NUMB_BITS + cnt; } diff --git a/mpn/generic/scan1.c b/mpn/generic/scan1.c index c6119c6d6..fd9a0f6c3 100644 --- a/mpn/generic/scan1.c +++ b/mpn/generic/scan1.c @@ -1,6 +1,6 @@ /* mpn_scan1 -- Scan from a given bit position for the next set bit. -Copyright 1994, 1996, 2001 Free Software Foundation, Inc. +Copyright 1994, 1996, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -41,16 +41,16 @@ mpn_scan1 (register mp_srcptr up, mp_srcptr p; /* Start at the word implied by STARTING_BIT. */ - starting_word = starting_bit / BITS_PER_MP_LIMB; + starting_word = starting_bit / GMP_NUMB_BITS; p = up + starting_word; alimb = *p++; /* Mask off any bits before STARTING_BIT in the first limb. */ - alimb &= - (mp_limb_t) 1 << (starting_bit % BITS_PER_MP_LIMB); + alimb &= - (mp_limb_t) 1 << (starting_bit % GMP_NUMB_BITS); while (alimb == 0) alimb = *p++; - count_leading_zeros (cnt, alimb & -alimb); - return (p - up) * BITS_PER_MP_LIMB - 1 - cnt; + count_trailing_zeros (cnt, alimb); + return (p - up - 1) * GMP_NUMB_BITS + cnt; } |