llvm.org GIT mirror llvm / 6e033d6
Improve overflow detection in StringRef::getAsUnsignedInteger(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165038 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Kledzik 6 years ago
1 changed file(s) with 2 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
349349 unsigned long long PrevResult = Result;
350350 Result = Result*Radix+CharVal;
351351
352 // Check for overflow.
353 if (Result < PrevResult)
352 // Check for overflow by shifting back and seeing if bits were lost.
353 if (Result/Radix < PrevResult)
354354 return true;
355355
356356 Str = Str.substr(1);