From 1580f9b51baf83e768541e67cfc6a1fe04e32119 Mon Sep 17 00:00:00 2001 From: Aleksey Komarov Date: Tue, 29 May 2018 07:45:05 +0300 Subject: [PATCH] fix building _std_extensions.h with MinGW --- src/xrCore/_std_extensions.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/xrCore/_std_extensions.h b/src/xrCore/_std_extensions.h index 85b14c5b4f0..92de7583662 100644 --- a/src/xrCore/_std_extensions.h +++ b/src/xrCore/_std_extensions.h @@ -87,11 +87,13 @@ IC bool _valid(const float x) noexcept { // check for: Signaling NaN, Quiet NaN, Negative infinity ( ???INF), Positive infinity (+INF), Negative denormalized, // Positive denormalized -#if defined(WINDOWS) +#if defined(WINDOWS) && defined(_MSC_VER) int cls = _fpclass(double(x)); if (cls & (_FPCLASS_SNAN + _FPCLASS_QNAN + _FPCLASS_NINF + _FPCLASS_PINF + _FPCLASS_ND + _FPCLASS_PD)) return false; -#endif +#else + #pragma todo("Find Linux alternative for _fpclass. Check https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/crt/math.h"); + /* *****other cases are***** _FPCLASS_NN Negative normalized non-zero _FPCLASS_NZ Negative zero ( ??? 0) @@ -99,6 +101,7 @@ IC bool _valid(const float x) noexcept _FPCLASS_PN Positive normalized non-zero */ return true; +#endif } // double @@ -106,11 +109,13 @@ IC bool _valid(const double x) { // check for: Signaling NaN, Quiet NaN, Negative infinity ( ???INF), Positive infinity (+INF), Negative denormalized, // Positive denormalized -#if defined(WINDOWS) +#if defined(WINDOWS) && defined(_MSC_VER) int cls = _fpclass(x); if (cls & (_FPCLASS_SNAN + _FPCLASS_QNAN + _FPCLASS_NINF + _FPCLASS_PINF + _FPCLASS_ND + _FPCLASS_PD)) return false; -#endif +#else + #pragma todo("Find Linux alternative for _fpclass. Check https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/crt/math.h"); + /* *****other cases are***** _FPCLASS_NN Negative normalized non-zero _FPCLASS_NZ Negative zero ( ??? 0) @@ -118,6 +123,7 @@ IC bool _valid(const double x) _FPCLASS_PN Positive normalized non-zero */ return true; +#endif } // XXX: "magic" specializations, that really require profiling to see if they are worth this effort.