[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
improve clang support (17)
From: |
Bruno Haible |
Subject: |
improve clang support (17) |
Date: |
Sun, 09 Aug 2020 18:35:37 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; ) |
clang has the __builtin_popcount{,l,ll} primitives, and they expand to
inline code (unlike the implementation in GCC), so it cannot cause a
link error.
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.
diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h
index 6c5b757..a9e166a 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- improve clang support (17),
Bruno Haible <=