diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index 8ccb736..9fa72c2 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -604,9 +604,8 @@ parse_int_string(UC const *p, UC const *pend, T &value, const uint32_t magic = ((digits + 0x46464646u) | (digits - 0x30303030u)) & 0x80808080u; - const auto tz = - static_cast(countr_zero_32(magic)); // 7, 15, 23, 31, or 32 - limb_t nd = (tz == 32) ? 4 : (tz >> 3); + const auto tz = countr_zero_32(magic); // 7, 15, 23, 31, or 32 + am_digits nd = (tz == 32) ? 4 : (tz >> 3); nd = std::min(nd, len); if (nd == 0) { if (has_leading_zeros) { diff --git a/include/fast_float/bigint.h b/include/fast_float/bigint.h index 6f4856c..8baf86c 100644 --- a/include/fast_float/bigint.h +++ b/include/fast_float/bigint.h @@ -567,7 +567,7 @@ struct bigint : pow5_tables<> { } // get the number of leading zeros in the bigint. - FASTFLOAT_CONSTEXPR20 limb_t ctlz() const noexcept { + FASTFLOAT_CONSTEXPR20 bigint_bits_t ctlz() const noexcept { if (vec.is_empty()) { // empty vector, no bits, no zeros. return 0; @@ -584,7 +584,7 @@ struct bigint : pow5_tables<> { // get the number of bits in the bigint. FASTFLOAT_CONSTEXPR20 bigint_bits_t bit_length() const noexcept { - limb_t lz = ctlz(); + bigint_bits_t lz = ctlz(); return static_cast(limb_bits * vec.len() - lz); } diff --git a/include/fast_float/decimal_to_binary.h b/include/fast_float/decimal_to_binary.h index a10d3c8..dd022c9 100644 --- a/include/fast_float/decimal_to_binary.h +++ b/include/fast_float/decimal_to_binary.h @@ -71,8 +71,8 @@ constexpr fastfloat_really_inline am_pow_t power(am_pow_t q) noexcept { // for significant digits already multiplied by 10 ** q. template fastfloat_really_inline FASTFLOAT_CONSTEXPR14 adjusted_mantissa -compute_error_scaled(int64_t q, uint64_t w, limb_t lz) noexcept { - auto const hilz = static_cast((w >> 63) ^ 1); +compute_error_scaled(int64_t q, uint64_t w, am_digits lz) noexcept { + auto const hilz = static_cast((w >> 63) ^ 1); adjusted_mantissa answer; answer.mantissa = w << hilz; constexpr am_pow_t bias = @@ -87,7 +87,7 @@ compute_error_scaled(int64_t q, uint64_t w, limb_t lz) noexcept { template fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa compute_error(int64_t q, uint64_t w) noexcept { - limb_t const lz = leading_zeroes(w); + am_digits const lz = leading_zeroes(w); w <<= lz; value128 product = compute_product_approximation(q, w); @@ -119,7 +119,7 @@ compute_float(int64_t q, uint64_t w) noexcept { // powers::largest_power_of_five]. // We want the most significant bit of i to be 1. Shift if needed. - limb_t const lz = leading_zeroes(w); + am_digits const lz = leading_zeroes(w); w <<= lz; // The required precision is binary::mantissa_explicit_bits() + 3 because diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index ae1c26b..4a43004 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -353,7 +353,7 @@ struct alignas(16) value128 { }; /* Helper C++14 constexpr generic implementation of leading_zeroes for 64-bit */ -fastfloat_really_inline FASTFLOAT_CONSTEXPR14 limb_t +fastfloat_really_inline FASTFLOAT_CONSTEXPR14 am_digits leading_zeroes_generic(uint64_t input_num, uint32_t last_bit = 0) noexcept { if (input_num & uint64_t(0xffffffff00000000)) { input_num >>= 32; @@ -378,11 +378,11 @@ leading_zeroes_generic(uint64_t input_num, uint32_t last_bit = 0) noexcept { if (input_num & uint64_t(0x2)) { /* input_num >>= 1; */ last_bit |= 1; } - return 63 - static_cast(last_bit); + return 63 - static_cast(last_bit); } /* result might be undefined when input_num is zero */ -fastfloat_really_inline FASTFLOAT_CONSTEXPR20 limb_t +fastfloat_really_inline FASTFLOAT_CONSTEXPR20 am_digits leading_zeroes(uint64_t input_num) noexcept { assert(input_num > 0); FASTFLOAT_ASSUME(input_num > 0); @@ -395,17 +395,17 @@ leading_zeroes(uint64_t input_num) noexcept { // Search the mask data from most significant bit (MSB) // to least significant bit (LSB) for a set bit (1). _BitScanReverse64(&leading_zero, input_num); - return static_cast(63 - leading_zero); + return static_cast(63 - leading_zero); #else - return static_cast(leading_zeroes_generic(input_num)); + return static_cast(leading_zeroes_generic(input_num)); #endif #else - return static_cast(__builtin_clzll(input_num)); + return static_cast(__builtin_clzll(input_num)); #endif } /* Helper C++14 constexpr generic implementation of countr_zero for 32-bit */ -fastfloat_really_inline FASTFLOAT_CONSTEXPR14 limb_t +fastfloat_really_inline FASTFLOAT_CONSTEXPR14 am_digits 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 static_cast(last_bit); + return static_cast(last_bit); } /* count trailing zeroes for 32-bit integers */ -fastfloat_really_inline FASTFLOAT_CONSTEXPR20 limb_t +fastfloat_really_inline FASTFLOAT_CONSTEXPR20 am_digits 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 static_cast(trailing_zero); + return static_cast(trailing_zero); } return 32; #else - return input_num == 0 ? 32 : static_cast(__builtin_ctz(input_num)); + return input_num == 0 ? 32 : static_cast(__builtin_ctz(input_num)); #endif }