[llvm] Make more math&bit functions constexpr, NFC (PR #145856)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 26 06:24:20 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) {
----------------
Disservin wrote:
I wonder if you are aware that not all code paths here (and some other functions) are actually available in constant expressions ? Like for MSVC it uses `_BitScanReverse` which itself isn't constexpr.
https://github.com/llvm/llvm-project/pull/145856
More information about the llvm-commits
mailing list