mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
Merge pull request #268 from yfeldblum/fix-deprecated-cxx17-cexpr-static-data-defn-out-of-line-redundant
remove out-of-line defns of constexpr static data members under c++17
This commit is contained in:
commit
c8abf94560
@ -404,12 +404,16 @@ template <typename = void> struct pow5_tables {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
|
||||
|
||||
template <typename T> constexpr uint32_t pow5_tables<T>::large_step;
|
||||
|
||||
template <typename T> constexpr uint64_t pow5_tables<T>::small_power_of_5[];
|
||||
|
||||
template <typename T> constexpr limb pow5_tables<T>::large_power_of_5[];
|
||||
|
||||
#endif
|
||||
|
||||
// big integer type. implements a small subset of big integer
|
||||
// arithmetic, using simple algorithms since asymptotically
|
||||
// faster algorithms are slower for a small number of limbs.
|
||||
|
||||
@ -37,4 +37,10 @@
|
||||
#define FASTFLOAT_IS_CONSTEXPR 0
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
|
||||
#define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 0
|
||||
#else
|
||||
#define FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE 1
|
||||
#endif
|
||||
|
||||
#endif // FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H
|
||||
|
||||
@ -693,10 +693,14 @@ template <class unused = void> struct powers_template {
|
||||
};
|
||||
};
|
||||
|
||||
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
|
||||
|
||||
template <class unused>
|
||||
constexpr uint64_t
|
||||
powers_template<unused>::power_of_five_128[number_of_entries];
|
||||
|
||||
#endif
|
||||
|
||||
using powers = powers_template<>;
|
||||
|
||||
} // namespace fast_float
|
||||
|
||||
@ -442,12 +442,16 @@ template <typename U> struct binary_format_lookup_tables<double, U> {
|
||||
constant_55555 * 5 * 5 * 5 * 5)};
|
||||
};
|
||||
|
||||
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
|
||||
|
||||
template <typename U>
|
||||
constexpr double binary_format_lookup_tables<double, U>::powers_of_ten[];
|
||||
|
||||
template <typename U>
|
||||
constexpr uint64_t binary_format_lookup_tables<double, U>::max_mantissa[];
|
||||
|
||||
#endif
|
||||
|
||||
template <typename U> struct binary_format_lookup_tables<float, U> {
|
||||
static constexpr float powers_of_ten[] = {1e0f, 1e1f, 1e2f, 1e3f, 1e4f, 1e5f,
|
||||
1e6f, 1e7f, 1e8f, 1e9f, 1e10f};
|
||||
@ -469,12 +473,16 @@ template <typename U> struct binary_format_lookup_tables<float, U> {
|
||||
0x1000000 / (constant_55555 * constant_55555 * 5)};
|
||||
};
|
||||
|
||||
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
|
||||
|
||||
template <typename U>
|
||||
constexpr float binary_format_lookup_tables<float, U>::powers_of_ten[];
|
||||
|
||||
template <typename U>
|
||||
constexpr uint64_t binary_format_lookup_tables<float, U>::max_mantissa[];
|
||||
|
||||
#endif
|
||||
|
||||
template <>
|
||||
inline constexpr int binary_format<double>::min_exponent_fast_path() {
|
||||
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
|
||||
@ -677,8 +685,12 @@ template <typename = void> struct space_lut {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
};
|
||||
|
||||
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
|
||||
|
||||
template <typename T> constexpr bool space_lut<T>::value[];
|
||||
|
||||
#endif
|
||||
|
||||
inline constexpr bool is_space(uint8_t c) { return space_lut<>::value[c]; }
|
||||
#endif
|
||||
|
||||
@ -759,12 +771,16 @@ template <typename = void> struct int_luts {
|
||||
3379220508056640625, 4738381338321616896};
|
||||
};
|
||||
|
||||
#if FASTFLOAT_DETAIL_MUST_DEFINE_CONSTEXPR_VARIABLE
|
||||
|
||||
template <typename T> constexpr uint8_t int_luts<T>::chdigit[];
|
||||
|
||||
template <typename T> constexpr size_t int_luts<T>::maxdigits_u64[];
|
||||
|
||||
template <typename T> constexpr uint64_t int_luts<T>::min_safe_u64[];
|
||||
|
||||
#endif
|
||||
|
||||
template <typename UC>
|
||||
fastfloat_really_inline constexpr uint8_t ch_to_digit(UC c) {
|
||||
return int_luts<>::chdigit[static_cast<unsigned char>(c)];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user