diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-03-20 18:32:27 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2012-03-20 18:32:27 +0100 |
commit | ace6bbd2e2ce98bafca5d406dd4aa670e15a9b6f (patch) | |
tree | 0d1ed6b1e31096645638809c345fe9bd0d1216fd /longlong.h | |
parent | a3f7a7b4a81b1713f91ce63e62eaecd766807350 (diff) | |
download | gmp-ace6bbd2e2ce98bafca5d406dd4aa670e15a9b6f.tar.gz |
Use __clz_tab[128] in count_trailing_zeros (C variant).
Diffstat (limited to 'longlong.h')
-rw-r--r-- | longlong.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/longlong.h b/longlong.h index a5af7b9a0..5bb6c5456 100644 --- a/longlong.h +++ b/longlong.h @@ -2051,7 +2051,7 @@ __GMP_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype); #endif #ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB -extern const unsigned char __GMP_DECLSPEC __clz_tab[128]; +extern const unsigned char __GMP_DECLSPEC __clz_tab[129]; #endif #if !defined (count_trailing_zeros) @@ -2074,14 +2074,14 @@ extern const unsigned char __GMP_DECLSPEC __clz_tab[128]; UWtype __ctz_x = (x); \ int __ctz_c; \ \ - if (LIKELY ((__ctz_x & 0x7f) != 0)) \ + if (LIKELY ((__ctz_x & 0xff) != 0)) \ (count) = __clz_tab[__ctz_x & -__ctz_x] - 2; \ else \ { \ - for (__ctz_c = 5; __ctz_c <= W_TYPE_SIZE; __ctz_c += 7) \ + for (__ctz_c = 8 - 2; __ctz_c < W_TYPE_SIZE - 2; __ctz_c += 8) \ { \ - __ctz_x >>= 7; \ - if (LIKELY ((__ctz_x & 0x7f) != 0)) \ + __ctz_x >>= 8; \ + if (LIKELY ((__ctz_x & 0xff) != 0)) \ break; \ } \ \ |