mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-30 06:38:14 +00:00
APInt: Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183073 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
77e5c2a179
commit
8e851920c0
@ -2304,24 +2304,7 @@ namespace {
|
|||||||
static unsigned int
|
static unsigned int
|
||||||
partMSB(integerPart value)
|
partMSB(integerPart value)
|
||||||
{
|
{
|
||||||
unsigned int n, msb;
|
return findLastSet(value, ZB_Max);
|
||||||
|
|
||||||
if (value == 0)
|
|
||||||
return -1U;
|
|
||||||
|
|
||||||
n = integerPartWidth / 2;
|
|
||||||
|
|
||||||
msb = 0;
|
|
||||||
do {
|
|
||||||
if (value >> n) {
|
|
||||||
value >>= n;
|
|
||||||
msb += n;
|
|
||||||
}
|
|
||||||
|
|
||||||
n >>= 1;
|
|
||||||
} while (n);
|
|
||||||
|
|
||||||
return msb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the bit number of the least significant set bit of a
|
/* Returns the bit number of the least significant set bit of a
|
||||||
@ -2329,24 +2312,7 @@ namespace {
|
|||||||
static unsigned int
|
static unsigned int
|
||||||
partLSB(integerPart value)
|
partLSB(integerPart value)
|
||||||
{
|
{
|
||||||
unsigned int n, lsb;
|
return findFirstSet(value, ZB_Max);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user