mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 04:29:21 +00:00
Implement isMinValuePlusOne using facilities of APInt instead of uint64_t
Patch by Zhou Sheng. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35187 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
44e33e674a
commit
727992c30a
@ -3463,12 +3463,11 @@ static bool isMaxValueMinusOne(const ConstantInt *C, bool isSigned) {
|
|||||||
static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) {
|
static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) {
|
||||||
if (isSigned) {
|
if (isSigned) {
|
||||||
// Calculate 1111111111000000000000
|
// Calculate 1111111111000000000000
|
||||||
unsigned TypeBits = C->getType()->getPrimitiveSizeInBits();
|
uint32_t TypeBits = C->getType()->getPrimitiveSizeInBits();
|
||||||
int64_t Val = -1; // All ones
|
APInt Val(APInt::getSignedMinValue(TypeBits));
|
||||||
Val <<= TypeBits-1; // Shift over to the right spot
|
return C->getValue() == Val+1;
|
||||||
return C->getSExtValue() == Val+1;
|
|
||||||
}
|
}
|
||||||
return C->getZExtValue() == 1; // unsigned
|
return C->getValue() == 1; // unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
// isOneBitSet - Return true if there is exactly one bit set in the specified
|
// isOneBitSet - Return true if there is exactly one bit set in the specified
|
||||||
|
Loading…
Reference in New Issue
Block a user