[libc-commits] [libc] [libc][__support][bit] add count_zeros (PR #82076)

via libc-commits libc-commits at lists.llvm.org
Fri Feb 16 16:19:41 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 2d9f3504491156282a3c785a562fcc0ba3c16161 2d4f7c7b8524b580c0100e5e52e7eae6b1408b18 -- libc/src/__support/CPP/bit.h libc/test/src/__support/CPP/bit_test.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/__support/CPP/bit.h b/libc/src/__support/CPP/bit.h
index 73c5949d86..7d11e7d5c4 100644
--- a/libc/src/__support/CPP/bit.h
+++ b/libc/src/__support/CPP/bit.h
@@ -259,9 +259,10 @@ template <typename T, typename = cpp::enable_if_t<cpp::is_unsigned_v<T>>>
       ++count;
   return count;
 }
-#define ADD_SPECIALIZATION(TYPE, BUILTIN)                                \
-  template <> [[nodiscard]] LIBC_INLINE constexpr int count_ones<TYPE>(TYPE value) { \
-    return BUILTIN(value); \
+#define ADD_SPECIALIZATION(TYPE, BUILTIN)                                      \
+  template <>                                                                  \
+  [[nodiscard]] LIBC_INLINE constexpr int count_ones<TYPE>(TYPE value) {       \
+    return BUILTIN(value);                                                     \
   }
 ADD_SPECIALIZATION(unsigned char, __builtin_popcount)
 ADD_SPECIALIZATION(unsigned short, __builtin_popcount)

``````````

</details>


https://github.com/llvm/llvm-project/pull/82076


More information about the libc-commits mailing list