mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-18 21:24:32 -04:00
[APInt] Move the single word cases of countTrailingZeros and countLeadingOnes inline for consistency with countTrailingOnes and countLeadingZeros. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306153 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -546,10 +546,7 @@ unsigned APInt::countLeadingZerosSlowCase() const {
|
||||
return Count;
|
||||
}
|
||||
|
||||
unsigned APInt::countLeadingOnes() const {
|
||||
if (isSingleWord())
|
||||
return llvm::countLeadingOnes(U.VAL << (APINT_BITS_PER_WORD - BitWidth));
|
||||
|
||||
unsigned APInt::countLeadingOnesSlowCase() const {
|
||||
unsigned highWordBits = BitWidth % APINT_BITS_PER_WORD;
|
||||
unsigned shift;
|
||||
if (!highWordBits) {
|
||||
@@ -573,9 +570,7 @@ unsigned APInt::countLeadingOnes() const {
|
||||
return Count;
|
||||
}
|
||||
|
||||
unsigned APInt::countTrailingZeros() const {
|
||||
if (isSingleWord())
|
||||
return std::min(unsigned(llvm::countTrailingZeros(U.VAL)), BitWidth);
|
||||
unsigned APInt::countTrailingZerosSlowCase() const {
|
||||
unsigned Count = 0;
|
||||
unsigned i = 0;
|
||||
for (; i < getNumWords() && U.pVal[i] == 0; ++i)
|
||||
|
||||
Reference in New Issue
Block a user