diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index 2e5a79e..ab3908f 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -52,7 +52,7 @@ read8_to_u64(UC const *chars) { if (cpp20_and_in_constexpr() || !std::is_same::value) { uint64_t val = 0; for (uint_fast8_t i = 0; i != 8; ++i) { - val |= uint64_t(uint_fast8_t(*chars)) << (i * 8); + val |= uint64_t(uint8_t(*chars)) << (i * 8); ++chars; } return val; @@ -72,7 +72,7 @@ read8_to_u64(UC const *chars) { #ifdef FASTFLOAT_SSE2 -fastfloat_really_inline uint64_t simd_read8_to_u64(__m128i const data) { +fastfloat_really_inline uint64_t simd_read8_to_u64(__m128i const &data) { FASTFLOAT_SIMD_DISABLE_WARNINGS __m128i const packed = _mm_packus_epi16(data, data); #ifdef FASTFLOAT_64BIT @@ -95,7 +95,7 @@ fastfloat_really_inline uint64_t simd_read8_to_u64(char16_t const *chars) { #elif defined(FASTFLOAT_NEON) -fastfloat_really_inline uint64_t simd_read8_to_u64(uint16x8_t const data) { +fastfloat_really_inline uint64_t simd_read8_to_u64(uint16x8_t const &data) { FASTFLOAT_SIMD_DISABLE_WARNINGS uint8x8_t utf8_packed = vmovn_u16(data); return vget_lane_u64(vreinterpret_u64_u8(utf8_packed), 0); @@ -125,9 +125,9 @@ uint64_t simd_read8_to_u64(UC const *) { // credit @aqrit fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t parse_eight_digits_unrolled(uint64_t val) noexcept { - uint64_t const mask = 0x000000FF000000FF; - uint64_t const mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32) - uint64_t const mul2 = 0x0000271000000001; // 1 + (10000ULL << 32) + constexpr uint64_t mask = 0x000000FF000000FF; + constexpr uint64_t mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32) + constexpr uint64_t mul2 = 0x0000271000000001; // 1 + (10000ULL << 32) val -= 0x3030303030303030; val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8; val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32; diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 66b66ac..7c9d367 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -446,7 +446,7 @@ full_multiplication(uint64_t a, uint64_t b) noexcept { // Value of the mantissa. typedef uint_fast64_t am_mant_t; -// Size of bits in the mantissa and path and roundings shifts +// Size of bits in the mantissa and path and rounding shifts typedef int_fast8_t am_bits_t; // Power bias is signed for handling a denormal float @@ -461,11 +461,11 @@ struct adjusted_mantissa { am_pow_t power2; adjusted_mantissa() noexcept = default; - constexpr bool operator==(adjusted_mantissa const o) const noexcept { + constexpr bool operator==(adjusted_mantissa const &o) const noexcept { return mantissa == o.mantissa && power2 == o.power2; } - constexpr bool operator!=(adjusted_mantissa const o) const noexcept { + constexpr bool operator!=(adjusted_mantissa const &o) const noexcept { return mantissa != o.mantissa || power2 != o.power2; } }; @@ -1041,7 +1041,7 @@ fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void to_float( #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN bool const negative, #endif - adjusted_mantissa const am, T &value) noexcept { + adjusted_mantissa const &am, T &value) noexcept { using equiv_uint = equiv_uint_t; equiv_uint word = equiv_uint(am.mantissa); word = equiv_uint(word | equiv_uint(am.power2)