Mercurial > hg > octave-nkf > gnulib-hg
changeset 17861:23f5fad4bfaf
count-leading-zeros: avoid 64-bit intrinsics on 32-bit Windows
* lib/count-leading-zeros.h (count_leading_zeros_ll): Use 32 bit
intrinsics in this case.
* lib/count-trailing-zeros.h: Likewise.
* lib/count-one-bits.h: Likewise.
author | Pádraig Brady <P@draigBrady.com> |
---|---|
date | Tue, 06 Jan 2015 02:27:16 +0000 |
parents | d12a1e47f996 |
children | 64996cee8e90 |
files | ChangeLog lib/count-leading-zeros.h lib/count-one-bits.h lib/count-trailing-zeros.h |
diffstat | 4 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-01-06 Pádraig Brady <P@draigBrady.com> + + count-leading-zeros: avoid 64-bit intrinsics on 32-bit Windows + * lib/count-leading-zeros.h (count_leading_zeros_ll): Use 32 bit + intrinsics in this case. + * lib/count-trailing-zeros.h: Likewise. + * lib/count-one-bits.h: Likewise. + 2015-01-06 Daiki Ueno <ueno@gnu.org> uniname/uniname: update to Unicode 7.0.0 To accommodate new
--- a/lib/count-leading-zeros.h +++ b/lib/count-leading-zeros.h @@ -104,8 +104,13 @@ COUNT_LEADING_ZEROS_INLINE int count_leading_zeros_ll (unsigned long long int x) { +# if _MSC_VER && ! defined _M_X64 + int count = count_leading_zeros (x >> 31 >> 1); + return count < 32 ? count : 32 + count_leading_zeros (x); +# else COUNT_LEADING_ZEROS (__builtin_clzll, _BitScanReverse64, unsigned long long int); +# endif } #endif
--- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -127,7 +127,11 @@ COUNT_ONE_BITS_INLINE int count_one_bits_ll (unsigned long long int x) { +# if _MSC_VER && ! defined _M_X64 + return count_one_bits (x >> 31 >> 1) + count_one_bits (x); +# else COUNT_ONE_BITS (__builtin_popcountll, __popcnt64, unsigned long long int); +# endif } #endif
--- a/lib/count-trailing-zeros.h +++ b/lib/count-trailing-zeros.h @@ -96,8 +96,13 @@ COUNT_TRAILING_ZEROS_INLINE int count_trailing_zeros_ll (unsigned long long int x) { +# if _MSC_VER && ! defined _M_X64 + int count = count_trailing_zeros (x); + return count < 32 ? count : 32 + count_trailing_zeros (x >> 31 >> 1); +# else COUNT_TRAILING_ZEROS (__builtin_ctzll, _BitScanForward64, unsigned long long int); +# endif } #endif