From: Bruno Haible Date: Sun, 9 Aug 2020 16:33:17 +0000 (+0200) Subject: count-one-bits: Use __builtin_popcount{,l,ll} on clang. X-Git-Tag: v1.0~3794 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c2250fd7f33592b8c2bcbb8c8f27ccd4f75cdf75;p=gnulib.git count-one-bits: Use __builtin_popcount{,l,ll} on clang. * lib/count-one-bits.h (COUNT_ONE_BITS): Use the GCC built-in. --- diff --git a/ChangeLog b/ChangeLog index 7c8865e292..7b23978c39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-08-09 Bruno Haible + + count-one-bits: Use __builtin_popcount{,l,ll} on clang. + * lib/count-one-bits.h (COUNT_ONE_BITS): Use the GCC built-in. + 2020-08-09 Bruno Haible Use attribute __aligned__ with clang. diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index 6c5b75708c..a9e166aed8 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -38,7 +38,8 @@ extern "C" { expand to code that computes the number of 1-bits of the local variable 'x' of type TYPE (an unsigned integer type) and return it from the current function. */ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) \ + || (__clang_major__ >= 4) # define COUNT_ONE_BITS(GCC_BUILTIN, MSC_BUILTIN, TYPE) \ return GCC_BUILTIN (x) #else