[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:
Craig Topper
2017-06-23 20:28:45 +00:00
parent a8f03fad1f
commit 7584e452e6
2 changed files with 18 additions and 9 deletions
+2 -7
View File
@@ -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)