git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313793
91177308-0d34-0410-b5e6-
96231b3b80d8
/// @{
/// \returns the floor log base 2 of this APInt.
- unsigned logBase2() const { return BitWidth - 1 - countLeadingZeros(); }
+ unsigned logBase2() const { return getActiveBits() - 1; }
/// \returns the ceil log base 2 of this APInt.
unsigned ceilLogBase2() const {
APInt temp(*this);
--temp;
- return BitWidth - temp.countLeadingZeros();
+ return temp.getActiveBits();
}
/// \returns the nearest log base 2 of this APInt. Ties round up.