Skip to content

Commit 4b94a61

Browse files
committed
type usage fix
1 parent 2f8ff9a commit 4b94a61

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

include/fast_float/ascii_number.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ parse_number_string(UC const *p, UC const *pend,
303303
answer.negative = (*p == UC('-'));
304304
// C++17 20.19.3.(7.1) explicitly forbids '+' sign here
305305
if ((*p == UC('-')) ||
306-
(chars_format_t(options.format & chars_format::allow_leading_plus) &&
307-
!basic_json_fmt && *p == UC('+'))) {
306+
((chars_format_t(options.format & chars_format::allow_leading_plus)) &&
307+
(!basic_json_fmt && *p == UC('+')))) {
308308
++p;
309309
if (p == pend) {
310310
return report_parse_error<UC>(
@@ -393,14 +393,14 @@ parse_number_string(UC const *p, UC const *pend,
393393
// Now we can parse the explicit exponential part.
394394
am_pow_t exp_number = 0; // explicit exponential part
395395
if (((p != pend) &&
396-
(((chars_format_t(options.format & chars_format::scientific) &&
397-
((UC('e') == *p) || (UC('E') == *p))))
396+
(((chars_format_t(options.format & chars_format::scientific)) &&
397+
((UC('e') == *p) || (UC('E') == *p))))
398398
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
399-
|| (chars_format_t(options.format & detail::basic_fortran_fmt) &&
400-
((UC('+') == *p) || (UC('-') == *p) || (UC('d') == *p) ||
401-
(UC('D') == *p)))
399+
|| (((chars_format_t(options.format & detail::basic_fortran_fmt))) &&
400+
((UC('+') == *p) || (UC('-') == *p) || (UC('d') == *p) ||
401+
(UC('D') == *p)))
402402
#endif
403-
))) {
403+
)) {
404404
UC const *location_of_e = p;
405405
#ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
406406
++p;
@@ -421,7 +421,7 @@ parse_number_string(UC const *p, UC const *pend,
421421
}
422422
}
423423
if ((p == pend) || !is_integer(*p)) {
424-
if (!chars_format_t(options.format & chars_format::fixed)) {
424+
if (!(chars_format_t(options.format & chars_format::fixed))) {
425425
// The exponential part is invalid for scientific notation, so it
426426
// must be a trailing token for fixed notation. However, fixed
427427
// notation is disabled, so report a scientific notation error.
@@ -445,8 +445,8 @@ parse_number_string(UC const *p, UC const *pend,
445445
}
446446
} else {
447447
// If it scientific and not fixed, we have to bail out.
448-
if (chars_format_t(options.format & chars_format::scientific) &&
449-
!chars_format_t(options.format & chars_format::fixed)) {
448+
if ((chars_format_t(options.format & chars_format::scientific)) &&
449+
!(chars_format_t(options.format & chars_format::fixed))) {
450450
return report_parse_error<UC>(p, parse_error::missing_exponential_part);
451451
}
452452
}
@@ -531,7 +531,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
531531
return answer;
532532
}
533533
if ((*p == UC('-')) ||
534-
(chars_format_t(options.format & chars_format::allow_leading_plus) &&
534+
((chars_format_t(options.format & chars_format::allow_leading_plus)) &&
535535
(*p == UC('+')))) {
536536
++p;
537537
}

include/fast_float/float_common.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ enum class chars_format : chars_format_t {
5858
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
5959
no_infnan = 1 << 3,
6060
// RFC 8259: https://datatracker.ietf.org/doc/html/rfc8259#section-6
61-
json = uint64_t(detail::basic_json_fmt) | general | no_infnan,
61+
json = chars_format_t(detail::basic_json_fmt) | general | no_infnan,
6262
// Extension of RFC 8259 where, e.g., "inf" and "nan" are allowed.
6363
json_or_infnan = chars_format_t(detail::basic_json_fmt) | general,
6464
fortran = chars_format_t(detail::basic_fortran_fmt) | general,
@@ -76,17 +76,12 @@ using from_chars_result = from_chars_result_t<char>;
7676

7777
template <typename UC> struct parse_options_t {
7878
constexpr explicit parse_options_t(
79-
chars_format_t const fmt = chars_format::general, UC const dot = UC('.'),
79+
chars_format const fmt = chars_format::general, UC const dot = UC('.'),
8080
uint_fast8_t const b = 10) noexcept
81-
: format(fmt), decimal_point(dot),
82-
base(b){
83-
#ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
84-
// static_assert(b >= 2 && b <= 36);
85-
#endif
86-
}
81+
: format(fmt), decimal_point(dot), base(b) {}
8782

88-
/** Which number formats are accepted */
89-
chars_format format;
83+
/** Which number formats are accepted */
84+
chars_format format;
9085
/** The character used as decimal point */
9186
UC decimal_point;
9287
/** The base used for integers */

include/fast_float/parse_number.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ from_chars_result_t<UC>
3333
bool const minusSign = (*first == UC('-'));
3434
// C++17 20.19.3.(7.1) explicitly forbids '+' sign here
3535
if ((*first == UC('-')) ||
36-
(chars_format_t(fmt & chars_format::allow_leading_plus) &&
36+
((chars_format_t(fmt & chars_format::allow_leading_plus)) &&
3737
(*first == UC('+')))) {
3838
++first;
3939
}
@@ -332,7 +332,7 @@ from_chars_float_advanced(UC const *first, UC const *last, T &value,
332332
#endif
333333
parsed_number_string_t<UC> const pns =
334334
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
335-
chars_format_t(options.format & detail::basic_json_fmt)
335+
(chars_format_t(options.format & detail::basic_json_fmt))
336336
? parse_number_string<true, UC>(first, last, options)
337337
:
338338
#endif
@@ -364,9 +364,8 @@ from_chars(UC const *first, UC const *last, T &value, int const base) noexcept {
364364
static_assert(is_supported_char_type<UC>::value,
365365
"only char, wchar_t, char16_t and char32_t are supported");
366366

367-
parse_options_t<UC> const options(
368-
static_cast<chars_format_t>(chars_format::general), UC('.'),
369-
static_cast<uint_fast8_t>(base));
367+
parse_options_t<UC> const options(chars_format::general, UC('.'),
368+
static_cast<uint_fast8_t>(base));
370369
return from_chars_advanced(first, last, value, options);
371370
}
372371

0 commit comments

Comments
 (0)