diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -91,3 +91,3 @@ template struct TrailingZerosCounter { - static unsigned count(T Val, ZeroBehavior) { + static constexpr unsigned count(T Val, ZeroBehavior) { if (!Val) @@ -115,3 +115,3 @@ template struct TrailingZerosCounter { - static unsigned count(T Val, ZeroBehavior ZB) { + static constexpr unsigned count(T Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) @@ -131,3 +131,3 @@ template struct TrailingZerosCounter { - static unsigned count(T Val, ZeroBehavior ZB) { + static constexpr unsigned count(T Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) @@ -156,3 +156,3 @@ template -unsigned countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) { +constexpr unsigned countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) { static_assert(std::numeric_limits::is_integer && @@ -165,3 +165,3 @@ template struct LeadingZerosCounter { - static unsigned count(T Val, ZeroBehavior) { + static constexpr unsigned count(T Val, ZeroBehavior) { if (!Val) @@ -184,3 +184,3 @@ template struct LeadingZerosCounter { - static unsigned count(T Val, ZeroBehavior ZB) { + static constexpr unsigned count(T Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) @@ -200,3 +200,3 @@ template struct LeadingZerosCounter { - static unsigned count(T Val, ZeroBehavior ZB) { + static constexpr unsigned count(T Val, ZeroBehavior ZB) { if (ZB != ZB_Undefined && Val == 0) @@ -225,3 +225,3 @@ template -unsigned countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) { +constexpr unsigned countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) { static_assert(std::numeric_limits::is_integer &&