From 812d89ec9b674a34a586aa89626bf21ed1c11c8f Mon Sep 17 00:00:00 2001 From: IRainman Date: Sat, 27 Dec 2025 15:55:58 +0300 Subject: [PATCH] type usage fixes. --- include/fast_float/ascii_number.h | 8 ++++---- include/fast_float/digit_comparison.h | 4 ++-- include/fast_float/float_common.h | 10 +++++----- include/fast_float/parse_number.h | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index a3ce62b..d42da42 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -561,7 +561,7 @@ parse_int_string(UC const *p, UC const *pend, T &value, auto const *const start_digits = p; FASTFLOAT_IF_CONSTEXPR17((std::is_same::value)) { - const auto len = static_cast(pend - p); + const auto len = static_cast(pend - p); if (len == 0) { if (has_leading_zeros) { value = 0; @@ -602,8 +602,8 @@ parse_int_string(UC const *p, UC const *pend, T &value, ((digits.as_int + 0x46464646u) | (digits.as_int - 0x30303030u)) & 0x80808080u; const auto tz = - static_cast(countr_zero_32(magic)); // 7, 15, 23, 31, or 32 - am_digits nd = (tz == 32) ? 4 : (tz >> 3); + static_cast(countr_zero_32(magic)); // 7, 15, 23, 31, or 32 + limb_t nd = (tz == 32) ? 4 : (tz >> 3); nd = std::min(nd, len); if (nd == 0) { if (has_leading_zeros) { @@ -618,7 +618,7 @@ parse_int_string(UC const *p, UC const *pend, T &value, } if (nd > 3) { const UC *q = p + nd; - am_digits rem = len - nd; + limb_t rem = len - nd; while (rem) { if (*q < UC('0') || *q > UC('9')) break; diff --git a/include/fast_float/digit_comparison.h b/include/fast_float/digit_comparison.h index c7837e1..b49acea 100644 --- a/include/fast_float/digit_comparison.h +++ b/include/fast_float/digit_comparison.h @@ -138,8 +138,8 @@ template fastfloat_really_inline FASTFLOAT_CONSTEXPR14 void round_nearest_tie_even(adjusted_mantissa &am, am_pow_t shift, callback cb) noexcept { - am_mant_t const mask = - (shift == 64) ? std::numeric_limits::max() : (am_mant_t(1) << shift) - 1; + am_mant_t const mask = (shift == 64) ? std::numeric_limits::max() + : (am_mant_t(1) << shift) - 1; am_mant_t const halfway = (shift == 0) ? 0 : am_mant_t(1) << (shift - 1); am_mant_t truncated_bits = am.mantissa & mask; bool is_above = truncated_bits > halfway; diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 7d54548..69b3c93 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -405,7 +405,7 @@ leading_zeroes(uint64_t input_num) noexcept { } /* Helper C++14 constexpr generic implementation of countr_zero for 32-bit */ -fastfloat_really_inline FASTFLOAT_CONSTEXPR14 uint32_t +fastfloat_really_inline FASTFLOAT_CONSTEXPR14 limb_t countr_zero_generic_32(uint32_t input_num) { if (input_num == 0) { return 32; @@ -430,11 +430,11 @@ countr_zero_generic_32(uint32_t input_num) { if (!(input_num & 0x1)) { last_bit |= 1; } - return last_bit; + return static_cast(last_bit); } /* count trailing zeroes for 32-bit integers */ -fastfloat_really_inline FASTFLOAT_CONSTEXPR20 int +fastfloat_really_inline FASTFLOAT_CONSTEXPR20 limb_t countr_zero_32(uint32_t input_num) { if (cpp20_and_in_constexpr()) { return countr_zero_generic_32(input_num); @@ -442,11 +442,11 @@ countr_zero_32(uint32_t input_num) { #ifdef FASTFLOAT_VISUAL_STUDIO unsigned long trailing_zero = 0; if (_BitScanForward(&trailing_zero, input_num)) { - return (int)trailing_zero; + return static_cast(trailing_zero); } return 32; #else - return input_num == 0 ? 32 : __builtin_ctz(input_num); + return input_num == 0 ? 32 : static_cast(__builtin_ctz(input_num)); #endif } diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index 97cbf04..750ad32 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -33,9 +33,8 @@ from_chars_result_t bool const minusSign = (*first == UC('-')); // C++17 20.19.3.(7.1) explicitly forbids '+' sign here - if (minusSign || - ((chars_format_t(fmt & chars_format::allow_leading_plus)) && - (*first == UC('+')))) { + if (minusSign || ((chars_format_t(fmt & chars_format::allow_leading_plus)) && + (*first == UC('+')))) { ++first; } @@ -481,7 +480,8 @@ template FASTFLOAT_CONSTEXPR20 typename std::enable_if< std::is_integral::value && !std::is_signed::value, double>::type integer_times_pow10(Int mantissa, am_pow_t decimal_exponent) noexcept { - return integer_times_pow10(static_cast(mantissa), decimal_exponent); + return integer_times_pow10(static_cast(mantissa), + decimal_exponent); } template