diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-06-04 14:27:33 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-06-04 14:27:33 +0200 |
commit | 139c4ae88b249a569814e3dc2d5b82806d35705e (patch) | |
tree | e677c24f5066fbf418033dfcd2c7618e5500d80a /lib/erl_interface/src/misc | |
parent | 99ccfe4d73b3ba82a8a461b53cb30cf512ee1bb9 (diff) | |
parent | 1a2ae45a5999850c1578e9ea0c0f993c04f934fb (diff) | |
download | otp-139c4ae88b249a569814e3dc2d5b82806d35705e.tar.gz otp-139c4ae88b249a569814e3dc2d5b82806d35705e.tar.bz2 otp-139c4ae88b249a569814e3dc2d5b82806d35705e.zip |
Merge branch 'dw/error_on_nan_inf/OTP-12801'
* dw/error_on_nan_inf/OTP-12801:
erl_interface: Move math.h include after eidef.h
erl_interface: Remove configure test for isfinite
erl_interface: Surround isfinite with HAVE_ISFINITE conditional
erl_interface: Move isfinite definition to header
erl_interface: Use isfinite instead of fpclassify
erl_interface: Document non finite encoding returns
Do not accept Nan and Infinity values
Fix one-letter typo
Diffstat (limited to 'lib/erl_interface/src/misc')
-rw-r--r-- | lib/erl_interface/src/misc/eidef.h | 21 |
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; |