Skip to content

Commit

Permalink
gcc constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
dalle committed Nov 17, 2024
1 parent b4d26ef commit 928859c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/fast_float/ascii_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ parse_number_string(UC const *p, UC const *pend,
answer.negative = (*p == UC('-')); // assume p < pend, so dereference without checks;
// C++17 20.19.3.(7.1) explicitly forbids '+' sign here
#ifdef FASTFLOAT_ALLOWS_LEADING_PLUS // disabled by default
if ((*p == UC('-')) || (!(fmt & detail::basic_json_fmt) && *p == UC('+'))) {
if ((*p == UC('-')) || (!int(fmt & detail::basic_json_fmt) && *p == UC('+'))) {
#else
if ((*p == UC('-')) || (int(fmt & chars_format::allow_leading_plus) &&
!int(fmt & detail::basic_json_fmt) && *p == UC('+'))) {
Expand Down
9 changes: 6 additions & 3 deletions include/fast_float/float_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,20 @@ constexpr chars_format operator^(chars_format lhs, chars_format rhs) noexcept {

constexpr chars_format &operator&=(chars_format &lhs,
chars_format rhs) noexcept {
return lhs = (lhs & rhs);
constexpr chars_format res = lhs & rhs;
return lhs = res;
}

constexpr chars_format &operator|=(chars_format &lhs,
chars_format rhs) noexcept {
return lhs = (lhs | rhs);
constexpr chars_format res = lhs | rhs;
return lhs = res;
}

constexpr chars_format &operator^=(chars_format &lhs,
chars_format rhs) noexcept {
return lhs = (lhs ^ rhs);
constexpr chars_format res = lhs ^ rhs;
return lhs = res;
}

template <typename UC> struct from_chars_result_t {
Expand Down

0 comments on commit 928859c

Please sign in to comment.