Skip to content

Commit 5c6a6c2

Browse files
committed
type usage fixes.
1 parent 5bc9637 commit 5c6a6c2

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

include/fast_float/ascii_number.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,8 @@ parse_int_string(UC const *p, UC const *pend, T &value,
604604

605605
const uint32_t magic =
606606
((digits + 0x46464646u) | (digits - 0x30303030u)) & 0x80808080u;
607-
const auto tz =
608-
static_cast<am_digits>(countr_zero_32(magic)); // 7, 15, 23, 31, or 32
609-
limb_t nd = (tz == 32) ? 4 : (tz >> 3);
607+
const auto tz = countr_zero_32(magic); // 7, 15, 23, 31, or 32
608+
am_digits nd = (tz == 32) ? 4 : (tz >> 3);
610609
nd = std::min(nd, len);
611610
if (nd == 0) {
612611
if (has_leading_zeros) {

include/fast_float/bigint.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ struct bigint : pow5_tables<> {
567567
}
568568

569569
// get the number of leading zeros in the bigint.
570-
FASTFLOAT_CONSTEXPR20 limb_t ctlz() const noexcept {
570+
FASTFLOAT_CONSTEXPR20 bigint_bits_t ctlz() const noexcept {
571571
if (vec.is_empty()) {
572572
// empty vector, no bits, no zeros.
573573
return 0;
@@ -584,7 +584,7 @@ struct bigint : pow5_tables<> {
584584

585585
// get the number of bits in the bigint.
586586
FASTFLOAT_CONSTEXPR20 bigint_bits_t bit_length() const noexcept {
587-
limb_t lz = ctlz();
587+
bigint_bits_t lz = ctlz();
588588
return static_cast<fast_float::bigint_bits_t>(limb_bits * vec.len() - lz);
589589
}
590590

include/fast_float/decimal_to_binary.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ constexpr fastfloat_really_inline am_pow_t power(am_pow_t q) noexcept {
7171
// for significant digits already multiplied by 10 ** q.
7272
template <typename binary>
7373
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 adjusted_mantissa
74-
compute_error_scaled(int64_t q, uint64_t w, limb_t lz) noexcept {
75-
auto const hilz = static_cast<limb_t>((w >> 63) ^ 1);
74+
compute_error_scaled(int64_t q, uint64_t w, am_digits lz) noexcept {
75+
auto const hilz = static_cast<am_digits>((w >> 63) ^ 1);
7676
adjusted_mantissa answer;
7777
answer.mantissa = w << hilz;
7878
constexpr am_pow_t bias =
@@ -87,7 +87,7 @@ compute_error_scaled(int64_t q, uint64_t w, limb_t lz) noexcept {
8787
template <typename binary>
8888
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa
8989
compute_error(int64_t q, uint64_t w) noexcept {
90-
limb_t const lz = leading_zeroes(w);
90+
am_digits const lz = leading_zeroes(w);
9191
w <<= lz;
9292
value128 product =
9393
compute_product_approximation<binary::mantissa_explicit_bits() + 3>(q, w);
@@ -119,7 +119,7 @@ compute_float(int64_t q, uint64_t w) noexcept {
119119
// powers::largest_power_of_five].
120120

121121
// We want the most significant bit of i to be 1. Shift if needed.
122-
limb_t const lz = leading_zeroes(w);
122+
am_digits const lz = leading_zeroes(w);
123123
w <<= lz;
124124

125125
// The required precision is binary::mantissa_explicit_bits() + 3 because

include/fast_float/float_common.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ struct alignas(16) value128 {
353353
};
354354

355355
/* Helper C++14 constexpr generic implementation of leading_zeroes for 64-bit */
356-
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 limb_t
356+
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 am_digits
357357
leading_zeroes_generic(uint64_t input_num, uint32_t last_bit = 0) noexcept {
358358
if (input_num & uint64_t(0xffffffff00000000)) {
359359
input_num >>= 32;
@@ -378,11 +378,11 @@ leading_zeroes_generic(uint64_t input_num, uint32_t last_bit = 0) noexcept {
378378
if (input_num & uint64_t(0x2)) { /* input_num >>= 1; */
379379
last_bit |= 1;
380380
}
381-
return 63 - static_cast<limb_t>(last_bit);
381+
return 63 - static_cast<am_digits>(last_bit);
382382
}
383383

384384
/* result might be undefined when input_num is zero */
385-
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 limb_t
385+
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 am_digits
386386
leading_zeroes(uint64_t input_num) noexcept {
387387
assert(input_num > 0);
388388
FASTFLOAT_ASSUME(input_num > 0);
@@ -395,17 +395,17 @@ leading_zeroes(uint64_t input_num) noexcept {
395395
// Search the mask data from most significant bit (MSB)
396396
// to least significant bit (LSB) for a set bit (1).
397397
_BitScanReverse64(&leading_zero, input_num);
398-
return static_cast<limb_t>(63 - leading_zero);
398+
return static_cast<am_digits>(63 - leading_zero);
399399
#else
400-
return static_cast<limb_t>(leading_zeroes_generic(input_num));
400+
return static_cast<am_digits>(leading_zeroes_generic(input_num));
401401
#endif
402402
#else
403-
return static_cast<limb_t>(__builtin_clzll(input_num));
403+
return static_cast<am_digits>(__builtin_clzll(input_num));
404404
#endif
405405
}
406406

407407
/* Helper C++14 constexpr generic implementation of countr_zero for 32-bit */
408-
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 limb_t
408+
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 am_digits
409409
countr_zero_generic_32(uint32_t input_num) {
410410
if (input_num == 0) {
411411
return 32;
@@ -430,23 +430,23 @@ countr_zero_generic_32(uint32_t input_num) {
430430
if (!(input_num & 0x1)) {
431431
last_bit |= 1;
432432
}
433-
return static_cast<limb_t>(last_bit);
433+
return static_cast<am_digits>(last_bit);
434434
}
435435

436436
/* count trailing zeroes for 32-bit integers */
437-
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 limb_t
437+
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 am_digits
438438
countr_zero_32(uint32_t input_num) {
439439
if (cpp20_and_in_constexpr()) {
440440
return countr_zero_generic_32(input_num);
441441
}
442442
#ifdef FASTFLOAT_VISUAL_STUDIO
443443
unsigned long trailing_zero = 0;
444444
if (_BitScanForward(&trailing_zero, input_num)) {
445-
return static_cast<limb_t>(trailing_zero);
445+
return static_cast<am_digits>(trailing_zero);
446446
}
447447
return 32;
448448
#else
449-
return input_num == 0 ? 32 : static_cast<limb_t>(__builtin_ctz(input_num));
449+
return input_num == 0 ? 32 : static_cast<am_digits>(__builtin_ctz(input_num));
450450
#endif
451451
}
452452

0 commit comments

Comments
 (0)