aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/misc
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-06-02 14:55:39 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-06-02 14:55:39 +0200
commit20dc34bfc200758f6a837d193e042d1e4653562f (patch)
treea2f15734a8ae6635bb9aa2c63951849500c8d2df /lib/erl_interface/src/misc
parent5a5e2b781a544883f29b5c46fbbc38a198f70f23 (diff)
downloadotp-20dc34bfc200758f6a837d193e042d1e4653562f.tar.gz
otp-20dc34bfc200758f6a837d193e042d1e4653562f.tar.bz2
otp-20dc34bfc200758f6a837d193e042d1e4653562f.zip
erl_interface: Move isfinite definition to header
Diffstat (limited to 'lib/erl_interface/src/misc')
-rw-r--r--lib/erl_interface/src/misc/eidef.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/erl_interface/src/misc/eidef.h b/lib/erl_interface/src/misc/eidef.h
index bd3d0bf631..e0dc325b48 100644
--- a/lib/erl_interface/src/misc/eidef.h
+++ b/lib/erl_interface/src/misc/eidef.h
@@ -41,6 +41,27 @@
typedef int socklen_t;
#endif
+#ifdef USE_ISINF_ISNAN /* simulate finite() */
+# define isfinite(f) (!isinf(f) && !isnan(f))
+# define HAVE_ISFINITE
+#elif defined(__GNUC__) && defined(HAVE_FINITE)
+/* We use finite in gcc as it emits assembler instead of
+ the function call that isfinite emits. The assembler is
+ significantly faster. */
+# ifdef isfinite
+# undef isfinite
+# endif
+# define isfinite finite
+# ifndef HAVE_ISFINITE
+# define HAVE_ISFINITE
+# endif
+#elif defined(isfinite) && !defined(HAVE_ISFINITE)
+# define HAVE_ISFINITE
+#elif !defined(HAVE_ISFINITE) && defined(HAVE_FINITE)
+# define isfinite finite
+# define HAVE_ISFINITE
+#endif
+
typedef unsigned char uint8; /* FIXME use configure */
typedef unsigned short uint16;
typedef unsigned int uint32;