Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
[Support] fix countLeadingZeros for types shorter than int
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330762 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
sam-mccall committed Apr 24, 2018
1 parent 1ae390f commit 79ac040
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/llvm/Support/MathExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ std::size_t countLeadingOnes(T Value, ZeroBehavior ZB = ZB_Width) {
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
Expand All @@ -471,7 +471,7 @@ std::size_t countTrailingOnes(T Value, ZeroBehavior ZB = ZB_Width) {
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 {
Expand Down

0 comments on commit 79ac040

Please sign in to comment.