Skip to content

Commit 2aba168

Browse files
committed
* optimize layout of the parsed_number_string_t.
1 parent b7fb05b commit 2aba168

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

include/fast_float/ascii_number.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,18 @@ enum class parse_error : uint_fast8_t {
250250
};
251251

252252
template <typename UC> struct parsed_number_string_t {
253-
// an unsigned int avoids signed overflows (which are bad)
254253
am_mant_t mantissa{0};
255254
am_pow_t exponent{0};
255+
// contains the range of the significant digits
256+
span<UC const> integer{}; // non-nullable
257+
span<UC const> fraction{}; // nullable
256258
UC const *lastmatch{nullptr};
257259
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
258260
bool negative{false};
259261
#endif
260-
bool invalid{false};
261-
bool too_many_digits{false};
262-
// contains the range of the significant digits
263-
span<UC const> integer{}; // non-nullable
264-
span<UC const> fraction{}; // nullable
265-
parse_error error{parse_error::no_error};
262+
bool invalid{false}; // be optimistic
263+
bool too_many_digits{false}; // be optimistic
264+
parse_error error{parse_error::no_error}; // be optimistic
266265
};
267266

268267
using byte_span = span<char const>;

include/fast_float/float_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ full_multiplication(uint64_t a, uint64_t b) noexcept {
502502
}
503503

504504
// Value of the mantissa.
505-
typedef uint_fast64_t am_mant_t;
505+
typedef uint_fast64_t am_mant_t; // an unsigned int avoids signed overflows (which are bad)
506506
// Size of bits in the mantissa and path and rounding shifts
507507
typedef int_fast8_t am_bits_t;
508508

0 commit comments

Comments
 (0)