From e12463583fc4b8f193667cf5c411f245d3a3673f Mon Sep 17 00:00:00 2001 From: Pavel Novikov Date: Sat, 6 Sep 2025 00:12:37 +0300 Subject: [PATCH] added lacking overloads to avoid potential ambiguity --- include/fast_float/parse_number.h | 12 ++++++++++++ tests/basictest.cpp | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index 416f5f7..71989f6 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -373,6 +373,18 @@ integer_times_pow10(int64_t mantissa, int decimal_exponent) noexcept { // the following overloads are here to avoid surprising ambiguity for int, // unsigned, etc. +#if !defined(_MSC_VER) +FASTFLOAT_CONSTEXPR20 inline double +integer_times_pow10(unsigned long long mantissa, + int decimal_exponent) noexcept { + return integer_times_pow10(static_cast(mantissa), decimal_exponent); +} + +FASTFLOAT_CONSTEXPR20 inline double +integer_times_pow10(long long mantissa, int decimal_exponent) noexcept { + return integer_times_pow10(static_cast(mantissa), decimal_exponent); +} +#endif FASTFLOAT_CONSTEXPR20 inline double integer_times_pow10(unsigned mantissa, int decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); diff --git a/tests/basictest.cpp b/tests/basictest.cpp index 4899b40..dc11752 100644 --- a/tests/basictest.cpp +++ b/tests/basictest.cpp @@ -2140,6 +2140,10 @@ TEST_CASE("integer_times_pow10") { -3141592653589793238, -18, -3.141592653589793238); verify_integer_multiplication_by_power_of_10( 3141592653589793238, -18, 3.141592653589793238); + verify_integer_multiplication_by_power_of_10( + -3141592653589793238, -18, -3.141592653589793238); + verify_integer_multiplication_by_power_of_10( + 3141592653589793238, -18, 3.141592653589793238); for (int mode : {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}) { fesetround(mode);