summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-08-09 18:33:17 +0200
committerBruno Haible <bruno@clisp.org>2020-08-09 18:33:17 +0200
commitc2250fd7f33592b8c2bcbb8c8f27ccd4f75cdf75 (patch)
treeb3114e2c256c3f6e7912288201aac5270eb4d039 /lib
parent1dcad478e8f8a10335a0dbd6f02b08d1f351ce19 (diff)
downloadgnulib-c2250fd7f33592b8c2bcbb8c8f27ccd4f75cdf75.tar.gz
count-one-bits: Use __builtin_popcount{,l,ll} on clang.
* lib/count-one-bits.h (COUNT_ONE_BITS): Use the GCC built-in.
Diffstat (limited to 'lib')
-rw-r--r--lib/count-one-bits.h3
1 files changed, 2 insertions, 1 deletions
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