1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

simplify getSetSize() per Duncan's comments

llvm-svn: 160368
This commit is contained in:
Nuno Lopes 2012-07-17 15:43:59 +00:00
parent dff0927cea
commit d85a4d34ce

View File

@ -146,14 +146,13 @@ APInt ConstantRange::getSetSize() const {
if (isEmptySet())
return APInt(getBitWidth()+1, 0);
if (isFullSet())
return APInt::getMaxValue(getBitWidth()).zext(getBitWidth()+1) + 1;
if (isWrappedSet()) {
APInt Result = Upper + (APInt::getMaxValue(getBitWidth()) - Lower + 1);
return Result.zext(getBitWidth()+1);
if (isFullSet()) {
APInt Size(getBitWidth()+1, 0);
Size.setBit(getBitWidth());
return Size;
}
// This is also correct for wrapped sets.
return (Upper - Lower).zext(getBitWidth()+1);
}