diff --git a/include/fast_float/fast_float.h b/include/fast_float/fast_float.h index bfef022..38c34e4 100644 --- a/include/fast_float/fast_float.h +++ b/include/fast_float/fast_float.h @@ -88,7 +88,7 @@ template ::value)> FASTFLOAT_CONSTEXPR20 from_chars_result_t from_chars(UC const *first, UC const *last, T &value, - uint_fast8_t const base = 10) noexcept; + base_t const base = 10) noexcept; } // namespace fast_float diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index 750ad32..913fc08 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -336,11 +336,13 @@ from_chars_float_advanced(UC const *first, UC const *last, T &value, ++first; } } -#endif +#else #ifdef FASTFLOAT_ISNOT_CHECKED_BOUNDS // We are in parser code with external loop that checks bounds. FASTFLOAT_ASSUME(first < last); -#else +#endif +#endif +#ifndef FASTFLOAT_ISNOT_CHECKED_BOUNDS if (first == last) { answer.ec = std::errc::invalid_argument; answer.ptr = first; @@ -414,13 +416,12 @@ FASTFLOAT_CONSTEXPR20 typename std::enable_if::value, T>::type integer_times_pow10(am_sign_mant_t const mantissa, am_pow_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); -#else +#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN const bool is_negative = mantissa < 0; - const am_mant_t m = - static_cast(is_negative ? -mantissa : mantissa); + const auto m = static_cast(is_negative ? -mantissa : mantissa); +#else + FASTFLOAT_ASSUME(mantissa >= 0); + const auto m = static_cast(mantissa); #endif T value; if (clinger_fast_path_impl(m, decimal_exponent, @@ -460,7 +461,8 @@ FASTFLOAT_CONSTEXPR20 std::is_integral::value && !std::is_signed::value, T>::type - integer_times_pow10(Int mantissa, am_pow_t decimal_exponent) noexcept { + integer_times_pow10(Int const mantissa, + am_pow_t const decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } @@ -471,7 +473,8 @@ FASTFLOAT_CONSTEXPR20 std::is_integral::value && std::is_signed::value, T>::type - integer_times_pow10(Int mantissa, am_pow_t decimal_exponent) noexcept { + integer_times_pow10(Int const mantissa, + am_pow_t const decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } @@ -479,7 +482,8 @@ FASTFLOAT_CONSTEXPR20 template FASTFLOAT_CONSTEXPR20 typename std::enable_if< std::is_integral::value && !std::is_signed::value, double>::type -integer_times_pow10(Int mantissa, am_pow_t decimal_exponent) noexcept { +integer_times_pow10(Int const mantissa, + am_pow_t const decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } @@ -487,7 +491,8 @@ integer_times_pow10(Int mantissa, am_pow_t decimal_exponent) noexcept { template FASTFLOAT_CONSTEXPR20 typename std::enable_if< std::is_integral::value && std::is_signed::value, double>::type -integer_times_pow10(Int mantissa, am_pow_t decimal_exponent) noexcept { +integer_times_pow10(Int const mantissa, + am_pow_t const decimal_exponent) noexcept { return integer_times_pow10(static_cast(mantissa), decimal_exponent); } @@ -508,10 +513,11 @@ from_chars_int_advanced(UC const *first, UC const *last, T &value, ++first; } } -#endif +#else #ifdef FASTFLOAT_ISNOT_CHECKED_BOUNDS // We are in parser code with external loop that checks bounds. FASTFLOAT_ASSUME(first < last); +#endif #endif if ( #ifndef FASTFLOAT_ISNOT_CHECKED_BOUNDS