Simplify overflow-on-add check in NumericLiteralParser::GetIntegerValue.

llvm-svn: 57629
This commit is contained in:
Daniel Dunbar 2008-10-16 06:39:30 +00:00
parent 122c9b1b22
commit b1f64426a0
1 changed files with 1 additions and 2 deletions

View File

@ -481,10 +481,9 @@ bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) {
Val *= RadixVal;
OverflowOccurred |= Val.udiv(RadixVal) != OldVal;
OldVal = Val;
// Add value, did overflow occur on the value?
// (a + b) ult b <=> overflow
Val += CharVal;
OverflowOccurred |= Val.ult(OldVal);
OverflowOccurred |= Val.ult(CharVal);
}
return OverflowOccurred;