# cleanup.

This commit is contained in:
IRainman 2025-10-21 22:01:22 +03:00
parent 487799ede2
commit 336b97d027
4 changed files with 17 additions and 20 deletions

View File

@ -345,9 +345,8 @@ parse_mantissa(bigint &result, const parsed_number_string_t<UC> &num) noexcept {
} }
template <typename T> template <typename T>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa positive_digit_comp(
positive_digit_comp( bigint &bigmant, adjusted_mantissa am, am_pow_t const exponent) noexcept {
bigint &bigmant, adjusted_mantissa& am, am_pow_t const exponent) noexcept {
FASTFLOAT_ASSERT(bigmant.pow10(exponent)); FASTFLOAT_ASSERT(bigmant.pow10(exponent));
bool truncated; bool truncated;
am.mantissa = bigmant.hi64(truncated); am.mantissa = bigmant.hi64(truncated);
@ -374,9 +373,8 @@ positive_digit_comp(
// we then need to scale by `2^(f- e)`, and then the two significant digits // we then need to scale by `2^(f- e)`, and then the two significant digits
// are of the same magnitude. // are of the same magnitude.
template <typename T> template <typename T>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp(
negative_digit_comp( bigint &bigmant, adjusted_mantissa am, am_pow_t const exponent) noexcept {
bigint &bigmant, adjusted_mantissa& am, am_pow_t const exponent) noexcept {
bigint &real_digits = bigmant; bigint &real_digits = bigmant;
am_pow_t const &real_exp = exponent; am_pow_t const &real_exp = exponent;
@ -385,9 +383,8 @@ negative_digit_comp(
adjusted_mantissa am_b = am; adjusted_mantissa am_b = am;
// gcc7 bug: use a lambda to remove the noexcept qualifier bug with // gcc7 bug: use a lambda to remove the noexcept qualifier bug with
// -Wnoexcept-type. // -Wnoexcept-type.
round<T>(am_b, [](adjusted_mantissa &a, am_pow_t shift) { round<T>(am_b,
round_down(a, shift); [](adjusted_mantissa &a, am_pow_t shift) { round_down(a, shift); });
});
T b; T b;
to_float( to_float(
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN #ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
@ -445,7 +442,7 @@ negative_digit_comp(
// of both, and use that to direct rounding. // of both, and use that to direct rounding.
template <typename T, typename UC> template <typename T, typename UC>
inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa digit_comp( inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa digit_comp(
parsed_number_string_t<UC> const &num, adjusted_mantissa& am) noexcept { parsed_number_string_t<UC> const &num, adjusted_mantissa am) noexcept {
// remove the invalid exponent bias // remove the invalid exponent bias
am.power2 -= invalid_am_bias; am.power2 -= invalid_am_bias;

View File

@ -73,11 +73,13 @@ integer_times_pow10(int64_t const mantissa,
template <typename T> template <typename T>
FASTFLOAT_CONSTEXPR20 FASTFLOAT_CONSTEXPR20
typename std::enable_if<is_supported_float_type<T>::value, T>::type typename std::enable_if<is_supported_float_type<T>::value, T>::type
integer_times_pow10(uint64_t const mantissa, int const decimal_exponent) noexcept; integer_times_pow10(uint64_t const mantissa,
int const decimal_exponent) noexcept;
template <typename T> template <typename T>
FASTFLOAT_CONSTEXPR20 FASTFLOAT_CONSTEXPR20
typename std::enable_if<is_supported_float_type<T>::value, T>::type typename std::enable_if<is_supported_float_type<T>::value, T>::type
integer_times_pow10(int64_t const mantissa, int const decimal_exponent) noexcept; integer_times_pow10(int64_t const mantissa,
int const decimal_exponent) noexcept;
/** /**
* from_chars for integer types. * from_chars for integer types.

View File

@ -213,16 +213,12 @@ using parse_options = parse_options_t<char>;
#ifndef FASTFLOAT_ASSERT #ifndef FASTFLOAT_ASSERT
#define FASTFLOAT_ASSERT(x) \ #define FASTFLOAT_ASSERT(x) \
{ \ { ((void)(x)); }
((void)(x)); \
}
#endif #endif
#ifndef FASTFLOAT_DEBUG_ASSERT #ifndef FASTFLOAT_DEBUG_ASSERT
#define FASTFLOAT_DEBUG_ASSERT(x) \ #define FASTFLOAT_DEBUG_ASSERT(x) \
{ \ { ((void)(x)); }
((void)(x)); \
}
#endif #endif
// rust style `try!()` macro, or `?` operator // rust style `try!()` macro, or `?` operator

View File

@ -410,7 +410,8 @@ FASTFLOAT_CONSTEXPR20
template <typename T> template <typename T>
FASTFLOAT_CONSTEXPR20 FASTFLOAT_CONSTEXPR20
typename std::enable_if<is_supported_float_type<T>::value, T>::type typename std::enable_if<is_supported_float_type<T>::value, T>::type
integer_times_pow10(int64_t const mantissa, int const decimal_exponent) noexcept { integer_times_pow10(int64_t const mantissa,
int const decimal_exponent) noexcept {
#ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN #ifdef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
FASTFLOAT_ASSUME(mantissa > 0); FASTFLOAT_ASSUME(mantissa > 0);
const uint64_t m = static_cast<uint64_t>(mantissa); const uint64_t m = static_cast<uint64_t>(mantissa);
@ -443,7 +444,8 @@ integer_times_pow10(uint64_t const mantissa,
} }
FASTFLOAT_CONSTEXPR20 inline double FASTFLOAT_CONSTEXPR20 inline double
integer_times_pow10(int64_t const mantissa, int const decimal_exponent) noexcept { integer_times_pow10(int64_t const mantissa,
int const decimal_exponent) noexcept {
return integer_times_pow10<double>(mantissa, decimal_exponent); return integer_times_pow10<double>(mantissa, decimal_exponent);
} }