summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2012-05-25 10:37:55 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2012-05-25 10:37:55 +0200
commita4418963e84469bf8d79331414ef3d625fbe9479 (patch)
tree34075e964762d7e37f73ac5150a928213d1c9393 /mpz
parentfb12479557da895b7e955115db17d565de04abe0 (diff)
downloadgmp-a4418963e84469bf8d79331414ef3d625fbe9479.tar.gz
mpz/scan1.c: Add a shortcut for scan1(z, 0).
Diffstat (limited to 'mpz')
-rw-r--r--mpz/scan1.c4
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)