summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-06-01 11:26:39 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-06-01 11:26:39 +0000
commitb565f899290de392804753347887fe54ba4990ae (patch)
tree859af15c6d0b3307035892a4e3dcd56dd8bdd6fa /llvm/lib
parent6bef24f3d7d9fbaf986f437e9266244afb273e28 (diff)
downloadbcm5719-llvm-b565f899290de392804753347887fe54ba4990ae.tar.gz
bcm5719-llvm-b565f899290de392804753347887fe54ba4990ae.zip
APInt: Simplify code. No functionality change.
llvm-svn: 183073
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/APInt.cpp38
1 files changed, 2 insertions, 36 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 108675d1e9a..89f96bd5774 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -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);
}
}
OpenPOWER on IntegriCloud