[llvm] r183073 - APInt: Simplify code. No functionality change.
Benjamin Kramer
benny.kra at googlemail.com
Sat Jun 1 04:26:39 PDT 2013
Author: d0k
Date: Sat Jun 1 06:26:39 2013
New Revision: 183073
URL: http://llvm.org/viewvc/llvm-project?rev=183073&view=rev
Log:
APInt: Simplify code. No functionality change.
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=183073&r1=183072&r2=183073&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Sat Jun 1 06:26:39 2013
@@ -2304,24 +2304,7 @@ namespace {
static unsigned int
partMSB(integerPart value)
{
- unsigned int n, msb;
-
- if (value == 0)
- return -1U;
-
- n = integerPartWidth / 2;
-
- msb = 0;
- do {
- if (value >> n) {
- value >>= n;
- msb += n;
- }
-
- n >>= 1;
- } while (n);
-
- return msb;
+ return findLastSet(value, ZB_Max);
}
/* Returns the bit number of the least significant set bit of a
@@ -2329,24 +2312,7 @@ namespace {
static unsigned int
partLSB(integerPart value)
{
- unsigned int n, lsb;
-
- if (value == 0)
- return -1U;
-
- lsb = integerPartWidth - 1;
- n = integerPartWidth / 2;
-
- do {
- if (value << n) {
- value <<= n;
- lsb -= n;
- }
-
- n >>= 1;
- } while (n);
-
- return lsb;
+ return findFirstSet(value, ZB_Max);
}
}
More information about the llvm-commits
mailing list