[llvm] Make more math&bit functions constexpr, NFC (PR #145856)

Haojian Wu via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 03:52:09 PDT 2025


================
@@ -200,7 +200,7 @@ template <typename T> [[nodiscard]] int countr_zero(T Val) {
 /// Only unsigned integral types are allowed.
 ///
 /// Returns std::numeric_limits<T>::digits on an input of 0.
-template <typename T> [[nodiscard]] int countl_zero(T Val) {
+template <typename T> [[nodiscard]] constexpr int countl_zero(T Val) {
----------------
hokein wrote:

Thanks for pointing it out! I didn’t check all the code paths — I only checked at the `__builtin_clz` version.



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


More information about the llvm-commits mailing list