Skip to content

Commit a92f025

Browse files
committed
* type usage fix
1 parent 3e498bb commit a92f025

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/fast_float/decimal_to_binary.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ namespace fast_float {
2020
template <limb_t bit_precision>
2121
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 value128
2222
compute_product_approximation(int64_t q, uint64_t w) noexcept {
23-
int const index = 2 * int(q - powers::smallest_power_of_five);
23+
am_pow_t const index = 2 * am_pow_t(q - powers::smallest_power_of_five);
2424
// For small values of q, e.g., q in [0,27], the answer is always exact
2525
// because The line value128 firstproduct = full_multiplication(w,
2626
// power_of_five_128[index]); gives the exact answer.
2727
value128 firstproduct =
2828
full_multiplication(w, powers::power_of_five_128[index]);
2929
static_assert((bit_precision >= 0) && (bit_precision <= 64),
30-
" precision should be in (0,64]");
30+
" precision should be in [0,64]");
3131
constexpr uint64_t precision_mask =
3232
(bit_precision < 64) ? (uint64_t(0xFFFFFFFFFFFFFFFF) >> bit_precision)
3333
: uint64_t(0xFFFFFFFFFFFFFFFF);
@@ -40,7 +40,7 @@ compute_product_approximation(int64_t q, uint64_t w) noexcept {
4040
full_multiplication(w, powers::power_of_five_128[index + 1]);
4141
firstproduct.low += secondproduct.high;
4242
if (secondproduct.high > firstproduct.low) {
43-
firstproduct.high++;
43+
++firstproduct.high;
4444
}
4545
}
4646
return firstproduct;
@@ -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, int32_t lz) noexcept {
75-
am_pow_t hilz = static_cast<am_pow_t>(uint64_t(w >> 63) ^ 1);
74+
compute_error_scaled(int64_t q, uint64_t w, limb_t lz) noexcept {
75+
limb_t const hilz = static_cast<limb_t>((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, int32_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 lz = leading_zeroes(w);
90+
limb_t 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 lz = leading_zeroes(w);
122+
limb_t const lz = leading_zeroes(w);
123123
w <<= lz;
124124

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

0 commit comments

Comments
 (0)