Skip to content

Commit

Permalink
harmonize ifdef checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dalle committed Dec 1, 2024
1 parent 3146e68 commit 0a1bf11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/fast_float/float_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ template <typename T>
struct is_supported_float_type
: std::integral_constant<bool, std::is_same<T, float>::value ||
std::is_same<T, double>::value
#if __STDCPP_FLOAT32_T__
#ifdef __STDCPP_FLOAT32_T__
|| std::is_same<T, std::float32_t>::value
#endif
#if __STDCPP_FLOAT64_T__
#ifdef __STDCPP_FLOAT64_T__
|| std::is_same<T, std::float64_t>::value
#endif
> {
Expand Down
4 changes: 2 additions & 2 deletions include/fast_float/parse_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename UC>
FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
Expand All @@ -162,7 +162,7 @@ template <> struct from_chars_caller<std::float32_t> {
};
#endif

#if __STDCPP_FLOAT64_T__ == 1
#ifdef __STDCPP_FLOAT64_T__
template <> struct from_chars_caller<std::float64_t> {
template <typename UC>
FASTFLOAT_CONSTEXPR20 static from_chars_result_t<UC>
Expand Down
4 changes: 2 additions & 2 deletions tests/fixedwidthtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
int main() {
// 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.
#if __STDCPP_FLOAT32_T__
#ifdef __STDCPP_FLOAT32_T__
std::vector<std::float32_t> const float32_test_expected{
123.456f, -78.9f, 0.0001f, 3.40282e+038f};
std::vector<std::string_view> const float32_test{"123.456", "-78.9", "0.0001",
Expand All @@ -37,7 +37,7 @@ int main() {
std::cout << "No std::float32_t type available." << std::endl;
#endif

#if __STDCPP_FLOAT64_T__
#ifdef __STDCPP_FLOAT64_T__
// Test cases for std::float64_t
std::vector<std::float64_t> const float64_test_expected{
1.23e4, -5.67e-8, 1.7976931348623157e+308, -1.7976931348623157e+308};
Expand Down

0 comments on commit 0a1bf11

Please sign in to comment.