diff options
author | Craig Topper <craig.topper@intel.com> | 2017-06-23 20:28:45 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-06-23 20:28:45 +0000 |
commit | 405165210b0b2f95e08d84ffcaab534fbd022fde (patch) | |
tree | 77bfd8798cb8b48b502fd11873cd66097b2e9d5f /llvm/lib/Support/APInt.cpp | |
parent | 68ed55e06a61e185ba5d45b709ca69319ece720e (diff) | |
download | bcm5719-llvm-405165210b0b2f95e08d84ffcaab534fbd022fde.tar.gz bcm5719-llvm-405165210b0b2f95e08d84ffcaab534fbd022fde.zip |
[APInt] Move the single word cases of countTrailingZeros and countLeadingOnes inline for consistency with countTrailingOnes and countLeadingZeros. NFCI
llvm-svn: 306153
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index e9716e3b1e8..c558ddd8216 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -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) |