[APInt] Use getActiveBits() to implement logBase2 and ceilLogBase2. NFC
llvm-svn: 313793
This commit is contained in:
parent
a0c897f634
commit
be46b4e6d7
|
@ -1724,13 +1724,13 @@ public:
|
|||
/// @{
|
||||
|
||||
/// \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.
|
||||
|
|
Loading…
Reference in New Issue