Skip to content

Commit a28e112

Browse files
committed
initialization cleanup.
1 parent 5857b98 commit a28e112

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

include/fast_float/ascii_number.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,16 @@ enum class parse_error : uint_fast8_t {
258258
};
259259

260260
template <typename UC> struct parsed_number_string_t {
261-
am_mant_t mantissa{0};
261+
am_mant_t mantissa;
262262

263263
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
264-
bool negative{false};
264+
bool negative;
265265
#endif
266-
bool invalid{false}; // be optimistic
267-
bool too_many_digits{false}; // be optimistic
268-
parse_error error{parse_error::no_error}; // be optimistic
266+
bool invalid;
267+
bool too_many_digits;
268+
parse_error error;
269269

270-
am_pow_t exponent{0};
270+
am_pow_t exponent;
271271

272272
// contains the range of the significant digits
273273
span<UC const> integer; // non-nullable
@@ -294,7 +294,7 @@ template <bool basic_json_fmt, typename UC>
294294
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 parsed_number_string_t<UC>
295295
parse_number_string(UC const *p, UC const *pend,
296296
parse_options_t<UC> const options) noexcept {
297-
parsed_number_string_t<UC> answer;
297+
parsed_number_string_t<UC> answer{};
298298
// so dereference without checks
299299
FASTFLOAT_ASSUME(p < pend);
300300
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
@@ -514,8 +514,8 @@ parse_number_string(UC const *p, UC const *pend,
514514
}
515515
answer.exponent = am_pow_t(answer.fraction.ptr - p) + exp_number;
516516
}
517+
// We now corrected both exponent and mantissa, to a truncated value
517518
}
518-
// We have now corrected both exponent and mantissa, to a truncated value
519519
}
520520

521521
return answer;

include/fast_float/float_common.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,16 @@ fastfloat_strncasecmp(UC const *actual_mixedcase, UC const *expected_lowercase,
347347
// a pointer and a length to a contiguous block of memory
348348
template <typename T> struct span {
349349
T const *ptr;
350-
uint_fast16_t length;
350+
am_digits length;
351351

352-
constexpr span(T const *_ptr, uint_fast16_t _length) noexcept
352+
constexpr span(T const *_ptr, am_digits _length) noexcept
353353
: ptr(_ptr), length(_length) {}
354354

355-
constexpr span() noexcept : ptr(nullptr), length(0) {}
355+
constexpr span() noexcept = default;
356356

357-
constexpr uint_fast16_t len() const noexcept { return length; }
357+
constexpr am_digits len() const noexcept { return length; }
358358

359-
FASTFLOAT_CONSTEXPR14 const T &
360-
operator[](uint_fast16_t index) const noexcept {
359+
FASTFLOAT_CONSTEXPR14 const T &operator[](am_digits index) const noexcept {
361360
FASTFLOAT_DEBUG_ASSERT(index < length);
362361
return ptr[index];
363362
}
@@ -370,7 +369,7 @@ struct alignas(16) value128 {
370369
constexpr value128(uint64_t _low, uint64_t _high) noexcept
371370
: low(_low), high(_high) {}
372371

373-
constexpr value128() noexcept {}
372+
constexpr value128() noexcept = default;
374373
};
375374

376375
/* Helper C++14 constexpr generic implementation of leading_zeroes for 64-bit */

0 commit comments

Comments
 (0)