Skip to content

Commit 1580f9b

Browse files
committed
fix building _std_extensions.h with MinGW
1 parent a50382e commit 1580f9b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/xrCore/_std_extensions.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,37 +87,43 @@ IC bool _valid(const float x) noexcept
8787
{
8888
// check for: Signaling NaN, Quiet NaN, Negative infinity ( ???INF), Positive infinity (+INF), Negative denormalized,
8989
// Positive denormalized
90-
#if defined(WINDOWS)
90+
#if defined(WINDOWS) && defined(_MSC_VER)
9191
int cls = _fpclass(double(x));
9292
if (cls & (_FPCLASS_SNAN + _FPCLASS_QNAN + _FPCLASS_NINF + _FPCLASS_PINF + _FPCLASS_ND + _FPCLASS_PD))
9393
return false;
94-
#endif
94+
#else
95+
#pragma todo("Find Linux alternative for _fpclass. Check https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/crt/math.h");
96+
9597
/* *****other cases are*****
9698
_FPCLASS_NN Negative normalized non-zero
9799
_FPCLASS_NZ Negative zero ( ??? 0)
98100
_FPCLASS_PZ Positive 0 (+0)
99101
_FPCLASS_PN Positive normalized non-zero
100102
*/
101103
return true;
104+
#endif
102105
}
103106

104107
// double
105108
IC bool _valid(const double x)
106109
{
107110
// check for: Signaling NaN, Quiet NaN, Negative infinity ( ???INF), Positive infinity (+INF), Negative denormalized,
108111
// Positive denormalized
109-
#if defined(WINDOWS)
112+
#if defined(WINDOWS) && defined(_MSC_VER)
110113
int cls = _fpclass(x);
111114
if (cls & (_FPCLASS_SNAN + _FPCLASS_QNAN + _FPCLASS_NINF + _FPCLASS_PINF + _FPCLASS_ND + _FPCLASS_PD))
112115
return false;
113-
#endif
116+
#else
117+
#pragma todo("Find Linux alternative for _fpclass. Check https://github.com/mirror/mingw-w64/blob/master/mingw-w64-headers/crt/math.h");
118+
114119
/* *****other cases are*****
115120
_FPCLASS_NN Negative normalized non-zero
116121
_FPCLASS_NZ Negative zero ( ??? 0)
117122
_FPCLASS_PZ Positive 0 (+0)
118123
_FPCLASS_PN Positive normalized non-zero
119124
*/
120125
return true;
126+
#endif
121127
}
122128

123129
// XXX: "magic" specializations, that really require profiling to see if they are worth this effort.

0 commit comments

Comments
 (0)