Skip to content

Commit

Permalink
fix building _std_extensions.h with MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
q4a committed May 29, 2018
1 parent a50382e commit 1580f9b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/xrCore/_std_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,37 +87,43 @@ 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)
_FPCLASS_PZ Positive 0 (+0)
_FPCLASS_PN Positive normalized non-zero
*/
return true;
#endif
}

// double
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)
_FPCLASS_PZ Positive 0 (+0)
_FPCLASS_PN Positive normalized non-zero
*/
return true;
#endif
}

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

0 comments on commit 1580f9b

Please sign in to comment.