mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-13 06:06:27 +00:00
simplify getSetSize() per Duncan's comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160368 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f30135c519
commit
5d2fada44c
@ -146,14 +146,13 @@ APInt ConstantRange::getSetSize() const {
|
|||||||
if (isEmptySet())
|
if (isEmptySet())
|
||||||
return APInt(getBitWidth()+1, 0);
|
return APInt(getBitWidth()+1, 0);
|
||||||
|
|
||||||
if (isFullSet())
|
if (isFullSet()) {
|
||||||
return APInt::getMaxValue(getBitWidth()).zext(getBitWidth()+1) + 1;
|
APInt Size(getBitWidth()+1, 0);
|
||||||
|
Size.setBit(getBitWidth());
|
||||||
if (isWrappedSet()) {
|
return Size;
|
||||||
APInt Result = Upper + (APInt::getMaxValue(getBitWidth()) - Lower + 1);
|
|
||||||
return Result.zext(getBitWidth()+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is also correct for wrapped sets.
|
||||||
return (Upper - Lower).zext(getBitWidth()+1);
|
return (Upper - Lower).zext(getBitWidth()+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user