summaryrefslogtreecommitdiff
path: root/math_compat.h
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2014-03-02 12:16:37 -0500
committerEric Haszlakiewicz <erh+git@nimenees.com>2014-03-02 12:16:37 -0500
commite6f1322b5e0fbbd5b8767b60c5fe34ff4468ec42 (patch)
tree268b98c1cc6987a728d8646a34e37881169010e3 /math_compat.h
parentdb117ca02bdd744a54f7258a2927aa97edbc5f0d (diff)
downloadjson-c-e6f1322b5e0fbbd5b8767b60c5fe34ff4468ec42.tar.gz
Issue#114: check for the presence of isnan and isinf, and provide compat macros on MSCV where _isnan and _finite exist instead.
Diffstat (limited to 'math_compat.h')
-rw-r--r--math_compat.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/math_compat.h b/math_compat.h
new file mode 100644
index 0000000..4a2721e
--- /dev/null
+++ b/math_compat.h
@@ -0,0 +1,20 @@
+#ifndef __math_compat_h
+#define __math_compat_h
+
+/* Define isnan and isinf on Windows/MSVC */
+
+#ifndef HAVE_DECL_ISNAN
+# ifdef HAVE_DECL__ISNAN
+#include <float.h>
+#define isnan(x) _isnan(x)
+# endif
+#endif
+
+#ifndef HAVE_DECL_ISINF
+# ifdef HAVE_DECL__FINITE
+#include <float.h>
+#define isinf(x) (!_finite(x))
+# endif
+#endif
+
+#endif