Skip to content

Commit 489703f

Browse files
committed
type usage fixes.
1 parent 8f49511 commit 489703f

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

include/fast_float/decimal_to_binary.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace fast_float {
1919
//
2020
template <limb_t bit_precision>
2121
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 value128
22-
compute_product_approximation(int64_t q, uint64_t w) noexcept {
22+
compute_product_approximation(am_pow_t q, am_mant_t w) noexcept {
2323
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,
@@ -71,22 +71,21 @@ 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, am_digits lz) noexcept {
75-
auto const hilz = static_cast<am_digits>((w >> 63) ^ 1);
74+
compute_error_scaled(am_pow_t q, am_mant_t w, am_digits lz) noexcept {
75+
auto const hilz = static_cast<am_pow_t>((w >> 63) ^ 1);
7676
adjusted_mantissa answer;
7777
answer.mantissa = w << hilz;
7878
constexpr am_pow_t bias =
7979
binary::mantissa_explicit_bits() - binary::minimum_exponent();
80-
answer.power2 = am_pow_t(detail::power(am_pow_t(q)) + bias - hilz - lz - 62 +
81-
invalid_am_bias);
80+
answer.power2 = detail::power(q) + bias - hilz - lz - 62 + invalid_am_bias;
8281
return answer;
8382
}
8483

8584
// w * 10 ** q, without rounding the representation up.
8685
// the power2 in the exponent will be adjusted by invalid_am_bias.
8786
template <typename binary>
8887
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa
89-
compute_error(int64_t q, uint64_t w) noexcept {
88+
compute_error(am_pow_t q, am_mant_t w) noexcept {
9089
am_digits const lz = leading_zeroes(w);
9190
w <<= lz;
9291
value128 product =
@@ -101,7 +100,7 @@ compute_error(int64_t q, uint64_t w) noexcept {
101100
// should recompute in such cases.
102101
template <typename binary>
103102
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa
104-
compute_float(int64_t q, uint64_t w) noexcept {
103+
compute_float(am_pow_t q, am_mant_t w) noexcept {
105104
adjusted_mantissa answer;
106105
if ((w == 0) || (q < binary::smallest_power_of_ten())) {
107106
answer.power2 = 0;
@@ -144,8 +143,7 @@ compute_float(int64_t q, uint64_t w) noexcept {
144143

145144
answer.mantissa = product.high >> shift;
146145

147-
answer.power2 = am_pow_t(detail::power(am_pow_t(q)) + upperbit - lz -
148-
binary::minimum_exponent());
146+
answer.power2 = detail::power(q) + upperbit - lz - binary::minimum_exponent();
149147
if (answer.power2 <= 0) { // we have a subnormal or very small value.
150148
// Here have that answer.power2 <= 0 so -answer.power2 >= 0
151149
if (-answer.power2 + 1 >=

include/fast_float/digit_comparison.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ to_extended(T const value) noexcept {
7676
am.mantissa = bits & mantissa_mask;
7777
} else {
7878
// normal
79-
am.power2 = am_pow_t((bits & exponent_mask) >>
80-
binary_format<T>::mantissa_explicit_bits());
79+
am.power2 = static_cast<am_pow_t>(bits & exponent_mask) >>
80+
binary_format<T>::mantissa_explicit_bits();
8181
am.power2 -= bias;
8282
am.mantissa = (bits & mantissa_mask) | hidden_bit_mask;
8383
}

0 commit comments

Comments
 (0)