@@ -291,7 +291,8 @@ parse_number_string(UC const *p, UC const *pend,
291
291
answer.too_many_digits = false ;
292
292
answer.negative = (*p == UC (' -' ));
293
293
#ifdef FASTFLOAT_ALLOWS_LEADING_PLUS // disabled by default
294
- if ((*p == UC (' -' )) || (!(fmt & FASTFLOAT_JSONFMT) && *p == UC (' +' ))) {
294
+ if ((*p == UC (' -' )) ||
295
+ (!uint64_t (fmt & detail::basic_json_fmt) && *p == UC (' +' ))) {
295
296
#else
296
297
if (*p == UC (' -' )) { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here
297
298
#endif
@@ -300,7 +301,7 @@ parse_number_string(UC const *p, UC const *pend,
300
301
return report_parse_error<UC>(
301
302
p, parse_error::missing_integer_or_dot_after_sign);
302
303
}
303
- if (fmt & FASTFLOAT_JSONFMT ) {
304
+ if (uint64_t ( fmt & detail::basic_json_fmt) ) {
304
305
if (!is_integer (*p)) { // a sign must be followed by an integer
305
306
return report_parse_error<UC>(p,
306
307
parse_error::missing_integer_after_sign);
@@ -329,7 +330,7 @@ parse_number_string(UC const *p, UC const *pend,
329
330
UC const *const end_of_integer_part = p;
330
331
int64_t digit_count = int64_t (end_of_integer_part - start_digits);
331
332
answer.integer = span<const UC>(start_digits, size_t (digit_count));
332
- if (fmt & FASTFLOAT_JSONFMT ) {
333
+ if (uint64_t ( fmt & detail::basic_json_fmt) ) {
333
334
// at least 1 digit in integer part, without leading zeros
334
335
if (digit_count == 0 ) {
335
336
return report_parse_error<UC>(p, parse_error::no_digits_in_integer_part);
@@ -358,7 +359,7 @@ parse_number_string(UC const *p, UC const *pend,
358
359
answer.fraction = span<const UC>(before, size_t (p - before));
359
360
digit_count -= exponent;
360
361
}
361
- if (fmt & FASTFLOAT_JSONFMT ) {
362
+ if (uint64_t ( fmt & detail::basic_json_fmt) ) {
362
363
// at least 1 digit in fractional part
363
364
if (has_decimal_point && exponent == 0 ) {
364
365
return report_parse_error<UC>(p,
@@ -369,9 +370,9 @@ parse_number_string(UC const *p, UC const *pend,
369
370
return report_parse_error<UC>(p, parse_error::no_digits_in_mantissa);
370
371
}
371
372
int64_t exp_number = 0 ; // explicit exponential part
372
- if (((fmt & chars_format::scientific) && (p != pend) &&
373
+ if ((uint64_t (fmt & chars_format::scientific) && (p != pend) &&
373
374
((UC (' e' ) == *p) || (UC (' E' ) == *p))) ||
374
- ((fmt & FASTFLOAT_FORTRANFMT ) && (p != pend) &&
375
+ (uint64_t (fmt & detail::basic_fortran_fmt ) && (p != pend) &&
375
376
((UC (' +' ) == *p) || (UC (' -' ) == *p) || (UC (' d' ) == *p) ||
376
377
(UC (' D' ) == *p)))) {
377
378
UC const *location_of_e = p;
@@ -389,7 +390,7 @@ parse_number_string(UC const *p, UC const *pend,
389
390
++p;
390
391
}
391
392
if ((p == pend) || !is_integer (*p)) {
392
- if (!(fmt & chars_format::fixed)) {
393
+ if (!uint64_t (fmt & chars_format::fixed)) {
393
394
// The exponential part is invalid for scientific notation, so it must
394
395
// be a trailing token for fixed notation. However, fixed notation is
395
396
// disabled, so report a scientific notation error.
@@ -412,7 +413,8 @@ parse_number_string(UC const *p, UC const *pend,
412
413
}
413
414
} else {
414
415
// If it scientific and not fixed, we have to bail out.
415
- if ((fmt & chars_format::scientific) && !(fmt & chars_format::fixed)) {
416
+ if (uint64_t (fmt & chars_format::scientific) &&
417
+ !uint64_t (fmt & chars_format::fixed)) {
416
418
return report_parse_error<UC>(p, parse_error::missing_exponential_part);
417
419
}
418
420
}
0 commit comments