[llvm-commits] [llvm] r152577 - /llvm/trunk/lib/Support/APInt.cpp
Benjamin Kramer
benny.kra at googlemail.com
Mon Mar 12 14:18:54 PDT 2012
Author: d0k
Date: Mon Mar 12 16:18:53 2012
New Revision: 152577
URL: http://llvm.org/viewvc/llvm-project?rev=152577&view=rev
Log:
Inline a trivial helper function.
Modified:
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=152577&r1=152576&r2=152577&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Mon Mar 12 16:18:53 2012
@@ -722,13 +722,9 @@
return Count;
}
-static unsigned countLeadingOnes_64(uint64_t V, unsigned skip) {
- return CountLeadingOnes_64(V << skip);
-}
-
unsigned APInt::countLeadingOnes() const {
if (isSingleWord())
- return countLeadingOnes_64(VAL, APINT_BITS_PER_WORD - BitWidth);
+ return CountLeadingOnes_64(VAL << (APINT_BITS_PER_WORD - BitWidth));
unsigned highWordBits = BitWidth % APINT_BITS_PER_WORD;
unsigned shift;
@@ -739,13 +735,13 @@
shift = APINT_BITS_PER_WORD - highWordBits;
}
int i = getNumWords() - 1;
- unsigned Count = countLeadingOnes_64(pVal[i], shift);
+ unsigned Count = CountLeadingOnes_64(pVal[i] << shift);
if (Count == highWordBits) {
for (i--; i >= 0; --i) {
if (pVal[i] == -1ULL)
Count += APINT_BITS_PER_WORD;
else {
- Count += countLeadingOnes_64(pVal[i], 0);
+ Count += CountLeadingOnes_64(pVal[i]);
break;
}
}
More information about the llvm-commits
mailing list