diff --git a/include/fast_float/fast_float.h b/include/fast_float/fast_float.h index 8d1d137..7e72120 100644 --- a/include/fast_float/fast_float.h +++ b/include/fast_float/fast_float.h @@ -60,10 +60,10 @@ from_chars_advanced(UC const *first, UC const *last, T &value, */ FASTFLOAT_CONSTEXPR20 inline double integer_times_pow10(uint64_t const mantissa, - int const decimal_exponent) noexcept; + int16_t const decimal_exponent) noexcept; FASTFLOAT_CONSTEXPR20 inline double integer_times_pow10(int64_t const mantissa, - int const decimal_exponent) noexcept; + int16_t const decimal_exponent) noexcept; /** * This function is a template overload of `integer_times_pow10()` @@ -74,12 +74,12 @@ template FASTFLOAT_CONSTEXPR20 typename std::enable_if::value, T>::type integer_times_pow10(uint64_t const mantissa, - int const decimal_exponent) noexcept; + int16_t const decimal_exponent) noexcept; template FASTFLOAT_CONSTEXPR20 typename std::enable_if::value, T>::type integer_times_pow10(int64_t const mantissa, - int const decimal_exponent) noexcept; + int16_t const decimal_exponent) noexcept; /** * from_chars for integer types. diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 1a952c5..8ff706f 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -446,7 +446,8 @@ typedef int_fast8_t am_bits_t; // Power bias is signed for handling a denormal float // or an invalid mantissa. -typedef int16_t am_pow_t; // can't be int_fast16_t because invalid_am_bias hacks. Needs rewriting this. +typedef int16_t am_pow_t; // can't be int_fast16_t because invalid_am_bias + // hacks. Needs rewriting this. // Bias so we can get the real exponent with an invalid adjusted_mantissa. constexpr static am_pow_t invalid_am_bias = -0x8000; diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index e69f7ba..d7ec565 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -388,7 +388,7 @@ template FASTFLOAT_CONSTEXPR20 typename std::enable_if::value, T>::type integer_times_pow10(uint64_t const mantissa, - int const decimal_exponent) noexcept { + int16_t const decimal_exponent) noexcept { T value; if (clinger_fast_path_impl(mantissa, decimal_exponent, #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN @@ -411,7 +411,7 @@ template FASTFLOAT_CONSTEXPR20 typename std::enable_if::value, T>::type integer_times_pow10(int64_t const mantissa, - int const decimal_exponent) noexcept { + int16_t const decimal_exponent) noexcept { #ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN FASTFLOAT_ASSUME(mantissa > 0); const am_mant_t m = static_cast(mantissa); @@ -440,13 +440,13 @@ FASTFLOAT_CONSTEXPR20 FASTFLOAT_CONSTEXPR20 inline double integer_times_pow10(uint64_t const mantissa, - int const decimal_exponent) noexcept { + int16_t const decimal_exponent) noexcept { return integer_times_pow10(mantissa, decimal_exponent); } FASTFLOAT_CONSTEXPR20 inline double integer_times_pow10(int64_t const mantissa, - int const decimal_exponent) noexcept { + int16_t const decimal_exponent) noexcept { return integer_times_pow10(mantissa, decimal_exponent); } @@ -458,7 +458,7 @@ FASTFLOAT_CONSTEXPR20 std::is_integral::value && !std::is_signed::value, T>::type - integer_times_pow10(Int mantissa, int decimal_exponent) noexcept { + integer_times_pow10(Int mantissa, int16_t decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } @@ -469,7 +469,7 @@ FASTFLOAT_CONSTEXPR20 std::is_integral::value && std::is_signed::value, T>::type - integer_times_pow10(Int mantissa, int decimal_exponent) noexcept { + integer_times_pow10(Int mantissa, int16_t decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } @@ -477,14 +477,14 @@ FASTFLOAT_CONSTEXPR20 template FASTFLOAT_CONSTEXPR20 typename std::enable_if< std::is_integral::value && !std::is_signed::value, double>::type -integer_times_pow10(Int mantissa, int decimal_exponent) noexcept { +integer_times_pow10(Int mantissa, int16_t decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } template FASTFLOAT_CONSTEXPR20 typename std::enable_if< std::is_integral::value && std::is_signed::value, double>::type -integer_times_pow10(Int mantissa, int decimal_exponent) noexcept { +integer_times_pow10(Int mantissa, int16_t decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } diff --git a/tests/basictest.cpp b/tests/basictest.cpp index 671ec3d..f0431d2 100644 --- a/tests/basictest.cpp +++ b/tests/basictest.cpp @@ -2127,7 +2127,7 @@ TEST_CASE("bfloat16.general") { template void verify_integer_times_pow10_result(Int const mantissa, - int const decimal_exponent, + int16_t const decimal_exponent, T const actual, U const expected) { static_assert(std::is_same::value, "expected and actual types must match"); @@ -2145,8 +2145,8 @@ void verify_integer_times_pow10_result(Int const mantissa, } template -T calculate_integer_times_pow10_expected_result(Int const mantissa, - int const decimal_exponent) { +T calculate_integer_times_pow10_expected_result( + Int const mantissa, int16_t const decimal_exponent) { std::string constructed_string = std::to_string(mantissa) + "e" + std::to_string(decimal_exponent); T expected_result; @@ -2160,7 +2160,7 @@ T calculate_integer_times_pow10_expected_result(Int const mantissa, template void verify_integer_times_pow10_dflt(Int const mantissa, - int const decimal_exponent, + int16_t const decimal_exponent, double const expected) { static_assert(std::is_integral::value); @@ -2174,7 +2174,7 @@ void verify_integer_times_pow10_dflt(Int const mantissa, template void verify_integer_times_pow10_dflt(Int const mantissa, - int const decimal_exponent) { + int16_t const decimal_exponent) { static_assert(std::is_integral::value); const auto expected_result = @@ -2185,7 +2185,8 @@ void verify_integer_times_pow10_dflt(Int const mantissa, } template -void verify_integer_times_pow10(Int const mantissa, int const decimal_exponent, +void verify_integer_times_pow10(Int const mantissa, + int16_t const decimal_exponent, T const expected) { static_assert(std::is_floating_point::value); static_assert(std::is_integral::value); @@ -2200,7 +2201,7 @@ void verify_integer_times_pow10(Int const mantissa, int const decimal_exponent, template void verify_integer_times_pow10(Int const mantissa, - int const decimal_exponent) { + int16_t const decimal_exponent) { static_assert(std::is_floating_point::value); static_assert(std::is_integral::value); @@ -2213,7 +2214,7 @@ void verify_integer_times_pow10(Int const mantissa, namespace all_supported_types { template void verify_integer_times_pow10(Int const mantissa, - int const decimal_exponent) { + int16_t const decimal_exponent) { static_assert(std::is_integral::value); // verify the "default" overload