[llvm] r330762 - [Support] fix countLeadingZeros for types shorter than int
Sam McCall via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 24 13:08:05 PDT 2018
Author: sammccall
Date: Tue Apr 24 13:08:05 2018
New Revision: 330762
URL: http://llvm.org/viewvc/llvm-project?rev=330762&view=rev
Log:
[Support] fix countLeadingZeros for types shorter than int
Modified:
llvm/trunk/include/llvm/Support/MathExtras.h
Modified: llvm/trunk/include/llvm/Support/MathExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MathExtras.h?rev=330762&r1=330761&r2=330762&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MathExtras.h (original)
+++ llvm/trunk/include/llvm/Support/MathExtras.h Tue Apr 24 13:08:05 2018
@@ -455,7 +455,7 @@ std::size_t countLeadingOnes(T Value, Ze
static_assert(std::numeric_limits<T>::is_integer &&
!std::numeric_limits<T>::is_signed,
"Only unsigned integral types are allowed.");
- return countLeadingZeros(~Value, ZB);
+ return countLeadingZeros<T>(~Value, ZB);
}
/// \brief Count the number of ones from the least significant bit to the first
@@ -471,7 +471,7 @@ std::size_t countTrailingOnes(T Value, Z
static_assert(std::numeric_limits<T>::is_integer &&
!std::numeric_limits<T>::is_signed,
"Only unsigned integral types are allowed.");
- return countTrailingZeros(~Value, ZB);
+ return countTrailingZeros<T>(~Value, ZB);
}
namespace detail {
More information about the llvm-commits
mailing list