summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-22 07:28:25 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-03-22 07:28:25 +0100
commit2d7a4180d3daded26e11db74024dd2fddd760a5b (patch)
tree4ac67bf310f41921cb369b9a28c7fe581d553cd9
parenteaa9f2518e12079bc8ca1313f605553a4bcad361 (diff)
compat/nan: support for mingw-w64 in a hacky way
-rw-r--r--compat/nan.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/compat/nan.cpp b/compat/nan.cpp
index a7b37362..4b99fff3 100644
--- a/compat/nan.cpp
+++ b/compat/nan.cpp
@@ -5,6 +5,20 @@
# define my_isnan std::isnan
# define my_isinf std::isinf
extern "C" OPENTRACK_COMPAT_EXPORT __declspec(noinline) bool nanp(double x)
+#elif defined __MINGW32__
+
+int __cdecl my_isnan(double)__asm__("__isnan");
+int __cdecl my_fpclassify(double)__asm__("___fpclassify");
+
+#define FP_NAN 0x0100
+#define FP_NORMAL 0x0400
+#define FP_INFINITE (FP_NAN | FP_NORMAL)
+#define FP_ZERO 0x4000
+#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO)
+
+#define my_isinf(x) (my_fpclassify(x) == FP_INFINITE)
+
+extern "C" OPENTRACK_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double x)
#else
int my_isnan(double)__asm__("isnan");
int my_isinf(double)__asm__("isinf");