type usage fixes.

This commit is contained in:
IRainman 2025-12-27 15:55:58 +03:00
parent fb1e92c0e2
commit 812d89ec9b
4 changed files with 15 additions and 15 deletions

View File

@ -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<T, std::uint8_t>::value)) {
const auto len = static_cast<am_digits>(pend - p);
const auto len = static_cast<limb_t>(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<am_digits>(countr_zero_32(magic)); // 7, 15, 23, 31, or 32
am_digits nd = (tz == 32) ? 4 : (tz >> 3);
static_cast<limb_t>(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;

View File

@ -138,8 +138,8 @@ template <typename callback>
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<am_mant_t>::max() : (am_mant_t(1) << shift) - 1;
am_mant_t const mask = (shift == 64) ? std::numeric_limits<am_mant_t>::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;

View File

@ -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<limb_t>(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<limb_t>(trailing_zero);
}
return 32;
#else
return input_num == 0 ? 32 : __builtin_ctz(input_num);
return input_num == 0 ? 32 : static_cast<limb_t>(__builtin_ctz(input_num));
#endif
}

View File

@ -33,9 +33,8 @@ from_chars_result_t<UC>
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 <typename Int>
FASTFLOAT_CONSTEXPR20 typename std::enable_if<
std::is_integral<Int>::value && !std::is_signed<Int>::value, double>::type
integer_times_pow10(Int mantissa, am_pow_t decimal_exponent) noexcept {
return integer_times_pow10(static_cast<am_mant_t>(mantissa), decimal_exponent);
return integer_times_pow10(static_cast<am_mant_t>(mantissa),
decimal_exponent);
}
template <typename Int>