diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-05-25 10:37:55 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-05-25 10:37:55 +0200 |
commit | a4418963e84469bf8d79331414ef3d625fbe9479 (patch) | |
tree | 34075e964762d7e37f73ac5150a928213d1c9393 /mpz | |
parent | fb12479557da895b7e955115db17d565de04abe0 (diff) | |
download | gmp-a4418963e84469bf8d79331414ef3d625fbe9479.tar.gz |
mpz/scan1.c: Add a shortcut for scan1(z, 0).
Diffstat (limited to 'mpz')
-rw-r--r-- | mpz/scan1.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mpz/scan1.c b/mpz/scan1.c index 5d2402697..e9bfacaa0 100644 --- a/mpz/scan1.c +++ b/mpz/scan1.c @@ -44,6 +44,10 @@ mpz_scan1 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW if (starting_limb >= abs_size) return (size >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit); + /* This is an important case, where sign is not relevant! */ + if (starting_bit == 0) + goto short_cut; + limb = *p; if (size >= 0) |