mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
harmonize ifdef checks
This commit is contained in:
parent
3146e686d0
commit
0a1bf11560
@ -221,10 +221,10 @@ template <typename T>
|
|||||||
struct is_supported_float_type
|
struct is_supported_float_type
|
||||||
: std::integral_constant<bool, std::is_same<T, float>::value ||
|
: std::integral_constant<bool, std::is_same<T, float>::value ||
|
||||||
std::is_same<T, double>::value
|
std::is_same<T, double>::value
|
||||||
#if __STDCPP_FLOAT32_T__
|
#ifdef __STDCPP_FLOAT32_T__
|
||||||
|| std::is_same<T, std::float32_t>::value
|
|| std::is_same<T, std::float32_t>::value
|
||||||
#endif
|
#endif
|
||||||
#if __STDCPP_FLOAT64_T__
|
#ifdef __STDCPP_FLOAT64_T__
|
||||||
|| std::is_same<T, std::float64_t>::value
|
|| std::is_same<T, std::float64_t>::value
|
||||||
#endif
|
#endif
|
||||||
> {
|
> {
|
||||||
|
|||||||
@ -145,7 +145,7 @@ template <typename T> struct from_chars_caller {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if __STDCPP_FLOAT32_T__ == 1
|
#ifdef __STDCPP_FLOAT32_T__
|
||||||
template <> struct from_chars_caller<std::float32_t> {
|
template <> struct from_chars_caller<std::float32_t> {
|
||||||
template <typename UC>
|
template <typename UC>
|
||||||
FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
|
FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
|
||||||
@ -162,7 +162,7 @@ template <> struct from_chars_caller<std::float32_t> {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __STDCPP_FLOAT64_T__ == 1
|
#ifdef __STDCPP_FLOAT64_T__
|
||||||
template <> struct from_chars_caller<std::float64_t> {
|
template <> struct from_chars_caller<std::float64_t> {
|
||||||
template <typename UC>
|
template <typename UC>
|
||||||
FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
|
FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
int main() {
|
int main() {
|
||||||
// Write some testcases for the parsing of floating point numbers in the
|
// Write some testcases for the parsing of floating point numbers in the
|
||||||
// float32_t type. We use the from_chars function defined in this library.
|
// float32_t type. We use the from_chars function defined in this library.
|
||||||
#if __STDCPP_FLOAT32_T__
|
#ifdef __STDCPP_FLOAT32_T__
|
||||||
std::vector<std::float32_t> const float32_test_expected{
|
std::vector<std::float32_t> const float32_test_expected{
|
||||||
123.456f, -78.9f, 0.0001f, 3.40282e+038f};
|
123.456f, -78.9f, 0.0001f, 3.40282e+038f};
|
||||||
std::vector<std::string_view> const float32_test{"123.456", "-78.9", "0.0001",
|
std::vector<std::string_view> const float32_test{"123.456", "-78.9", "0.0001",
|
||||||
@ -37,7 +37,7 @@ int main() {
|
|||||||
std::cout << "No std::float32_t type available." << std::endl;
|
std::cout << "No std::float32_t type available." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __STDCPP_FLOAT64_T__
|
#ifdef __STDCPP_FLOAT64_T__
|
||||||
// Test cases for std::float64_t
|
// Test cases for std::float64_t
|
||||||
std::vector<std::float64_t> const float64_test_expected{
|
std::vector<std::float64_t> const float64_test_expected{
|
||||||
1.23e4, -5.67e-8, 1.7976931348623157e+308, -1.7976931348623157e+308};
|
1.23e4, -5.67e-8, 1.7976931348623157e+308, -1.7976931348623157e+308};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user