diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index e999bcb..a0edaa9 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -258,16 +258,16 @@ enum class parse_error : uint_fast8_t { }; template struct parsed_number_string_t { - am_mant_t mantissa{0}; + am_mant_t mantissa; #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN - bool negative{false}; + bool negative; #endif - bool invalid{false}; // be optimistic - bool too_many_digits{false}; // be optimistic - parse_error error{parse_error::no_error}; // be optimistic + bool invalid; + bool too_many_digits; + parse_error error; - am_pow_t exponent{0}; + am_pow_t exponent; // contains the range of the significant digits span integer; // non-nullable @@ -294,7 +294,7 @@ template fastfloat_really_inline FASTFLOAT_CONSTEXPR20 parsed_number_string_t parse_number_string(UC const *p, UC const *pend, parse_options_t const options) noexcept { - parsed_number_string_t answer; + parsed_number_string_t answer{}; // so dereference without checks FASTFLOAT_ASSUME(p < pend); #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN @@ -514,8 +514,8 @@ parse_number_string(UC const *p, UC const *pend, } answer.exponent = am_pow_t(answer.fraction.ptr - p) + exp_number; } + // We now corrected both exponent and mantissa, to a truncated value } - // We have now corrected both exponent and mantissa, to a truncated value } return answer; diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index acd15d6..0c2e865 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -347,17 +347,16 @@ fastfloat_strncasecmp(UC const *actual_mixedcase, UC const *expected_lowercase, // a pointer and a length to a contiguous block of memory template struct span { T const *ptr; - uint_fast16_t length; + am_digits length; - constexpr span(T const *_ptr, uint_fast16_t _length) noexcept + constexpr span(T const *_ptr, am_digits _length) noexcept : ptr(_ptr), length(_length) {} - constexpr span() noexcept : ptr(nullptr), length(0) {} + constexpr span() noexcept = default; - constexpr uint_fast16_t len() const noexcept { return length; } + constexpr am_digits len() const noexcept { return length; } - FASTFLOAT_CONSTEXPR14 const T & - operator[](uint_fast16_t index) const noexcept { + FASTFLOAT_CONSTEXPR14 const T &operator[](am_digits index) const noexcept { FASTFLOAT_DEBUG_ASSERT(index < length); return ptr[index]; } @@ -370,7 +369,7 @@ struct alignas(16) value128 { constexpr value128(uint64_t _low, uint64_t _high) noexcept : low(_low), high(_high) {} - constexpr value128() noexcept {} + constexpr value128() noexcept = default; }; /* Helper C++14 constexpr generic implementation of leading_zeroes for 64-bit */