File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
flang/include/flang/Common Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 11
11
12
12
#include " Fortran-consts.h"
13
13
#include " enum-set.h"
14
- #include " llvm/Support/MathExtras.h"
15
14
#include < cstring>
16
15
17
16
// Define a FormatValidator class template to validate a format expression
@@ -215,18 +214,16 @@ template <typename CHAR> void FormatValidator<CHAR>::NextToken() {
215
214
case ' 7' :
216
215
case ' 8' :
217
216
case ' 9' : {
217
+ int64_t lastValue;
218
218
const CHAR *lastCursor;
219
219
integerValue_ = 0 ;
220
220
bool overflow{false };
221
221
do {
222
+ lastValue = integerValue_;
222
223
lastCursor = cursor_;
223
- if (LLVM_LIKELY (!overflow)) {
224
- overflow = llvm::MulOverflow (
225
- static_cast <int64_t >(10 ), integerValue_, integerValue_);
226
- }
227
- if (LLVM_LIKELY (!overflow)) {
228
- overflow = llvm::AddOverflow (
229
- integerValue_, static_cast <int64_t >(c - ' 0' ), integerValue_);
224
+ integerValue_ = 10 * integerValue_ + c - ' 0' ;
225
+ if (lastValue > integerValue_) {
226
+ overflow = true ;
230
227
}
231
228
c = NextChar ();
232
229
} while (c >= ' 0' && c <= ' 9' );
You can’t perform that action at this time.
0 commit comments