]> Savannah Git Hosting - gnulib.git/commitdiff
count-one-bits: Use __builtin_popcount{,l,ll} on clang.
authorBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 16:33:17 +0000 (18:33 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 16:33:17 +0000 (18:33 +0200)
* lib/count-one-bits.h (COUNT_ONE_BITS): Use the GCC built-in.

ChangeLog
lib/count-one-bits.h

index 7c8865e2928d7510d9ccb8b4b91506115d1c05bb..7b23978c39b62d74328fb397a82a70dca4581d4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-09  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        Use attribute __aligned__ with clang.
index 6c5b75708cf607fbbf8515503c19c0aad4a1f1ca..a9e166aed8c40d4e840b8cd66d1be5e637a4bf98 100644 (file)
@@ -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