mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 08:46:49 +08:00
# cleanup.
This commit is contained in:
parent
487799ede2
commit
336b97d027
@ -345,9 +345,8 @@ parse_mantissa(bigint &result, const parsed_number_string_t<UC> &num) noexcept {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa
|
||||
positive_digit_comp(
|
||||
bigint &bigmant, adjusted_mantissa& am, am_pow_t const exponent) noexcept {
|
||||
inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa positive_digit_comp(
|
||||
bigint &bigmant, adjusted_mantissa am, am_pow_t const exponent) noexcept {
|
||||
FASTFLOAT_ASSERT(bigmant.pow10(exponent));
|
||||
bool 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
|
||||
// are of the same magnitude.
|
||||
template <typename T>
|
||||
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa
|
||||
negative_digit_comp(
|
||||
bigint &bigmant, adjusted_mantissa& am, am_pow_t const exponent) noexcept {
|
||||
inline FASTFLOAT_CONSTEXPR20 adjusted_mantissa negative_digit_comp(
|
||||
bigint &bigmant, adjusted_mantissa am, am_pow_t const exponent) noexcept {
|
||||
bigint &real_digits = bigmant;
|
||||
am_pow_t const &real_exp = exponent;
|
||||
|
||||
@ -385,9 +383,8 @@ negative_digit_comp(
|
||||
adjusted_mantissa am_b = am;
|
||||
// gcc7 bug: use a lambda to remove the noexcept qualifier bug with
|
||||
// -Wnoexcept-type.
|
||||
round<T>(am_b, [](adjusted_mantissa &a, am_pow_t shift) {
|
||||
round_down(a, shift);
|
||||
});
|
||||
round<T>(am_b,
|
||||
[](adjusted_mantissa &a, am_pow_t shift) { round_down(a, shift); });
|
||||
T b;
|
||||
to_float(
|
||||
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
|
||||
@ -445,7 +442,7 @@ negative_digit_comp(
|
||||
// of both, and use that to direct rounding.
|
||||
template <typename T, typename UC>
|
||||
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
|
||||
am.power2 -= invalid_am_bias;
|
||||
|
||||
|
||||
@ -73,11 +73,13 @@ integer_times_pow10(int64_t const mantissa,
|
||||
template <typename T>
|
||||
FASTFLOAT_CONSTEXPR20
|
||||
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>
|
||||
FASTFLOAT_CONSTEXPR20
|
||||
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.
|
||||
|
||||
@ -213,16 +213,12 @@ using parse_options = parse_options_t<char>;
|
||||
|
||||
#ifndef FASTFLOAT_ASSERT
|
||||
#define FASTFLOAT_ASSERT(x) \
|
||||
{ \
|
||||
((void)(x)); \
|
||||
}
|
||||
{ ((void)(x)); }
|
||||
#endif
|
||||
|
||||
#ifndef FASTFLOAT_DEBUG_ASSERT
|
||||
#define FASTFLOAT_DEBUG_ASSERT(x) \
|
||||
{ \
|
||||
((void)(x)); \
|
||||
}
|
||||
{ ((void)(x)); }
|
||||
#endif
|
||||
|
||||
// rust style `try!()` macro, or `?` operator
|
||||
|
||||
@ -410,7 +410,8 @@ FASTFLOAT_CONSTEXPR20
|
||||
template <typename T>
|
||||
FASTFLOAT_CONSTEXPR20
|
||||
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
|
||||
FASTFLOAT_ASSUME(mantissa > 0);
|
||||
const uint64_t m = static_cast<uint64_t>(mantissa);
|
||||
@ -443,7 +444,8 @@ integer_times_pow10(uint64_t const mantissa,
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user