projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fdb1585
)
Improve overflow detection in StringRef::getAsUnsignedInteger().
author
Nick Kledzik
<kledzik@apple.com>
Tue, 2 Oct 2012 20:01:48 +0000
(20:01 +0000)
committer
Nick Kledzik
<kledzik@apple.com>
Tue, 2 Oct 2012 20:01:48 +0000
(20:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165038
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Support/StringRef.cpp
patch
|
blob
|
history
diff --git
a/lib/Support/StringRef.cpp
b/lib/Support/StringRef.cpp
index 8aab4b2760e73ed37491f9549291abce50af6879..f8e9208462593eacc2d504b30a2a62279cb78ca0 100644
(file)
--- a/
lib/Support/StringRef.cpp
+++ b/
lib/Support/StringRef.cpp
@@
-350,8
+350,8
@@
bool llvm::getAsUnsignedInteger(StringRef Str, unsigned Radix,
unsigned long long PrevResult = Result;
Result = Result*Radix+CharVal;
- // Check for overflow.
- if (Result < PrevResult)
+ // Check for overflow
by shifting back and seeing if bits were lost
.
+ if (Result
/Radix
< PrevResult)
return true;
Str = Str.substr(1);