From ec1632426a56a5ba9771ed31abfd747510b185b9 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 8 Dec 2007 22:40:56 +0000 Subject: * sockio-c.c: Include (plus_infinity): Use INFINITY if available. (minus_infinity): Use plus_infinity(). (NANQ): Use NAN if available. --- src/lib/ChangeLog | 7 +++++++ src/lib/sockio-c.c | 22 ++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/ChangeLog b/src/lib/ChangeLog index a77f2c17..3d78f5f1 100644 --- a/src/lib/ChangeLog +++ b/src/lib/ChangeLog @@ -1,3 +1,10 @@ +2007-12-08 Gabriel Dos Reis + + * sockio-c.c: Include + (plus_infinity): Use INFINITY if available. + (minus_infinity): Use plus_infinity(). + (NANQ): Use NAN if available. + 2007-12-04 Gabriel Dos Reis * sockio-c.c (plus_infinity): Use GCC builtin. diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index 718276b1..31c849bb 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -48,6 +48,9 @@ #include #include +#define _ISOC99_SOURCE +#include + #include "com.h" #include "bsdsignal.h" @@ -1149,23 +1152,30 @@ print_line(char *s) } -/* The next three functions use GCC extensions. At the moment, that - is not a problem because GCC is a requirement. */ - double plus_infinity(void ) { - return __builtin_huge_val(); +#ifdef INFINITY + return INFINITY; +#else + /* This must be a curious platform. */ + volatile double zero = 0.0; + return 1.0 / zero; /* If it traps, well, it traps. */ +#endif } double minus_infinity(void) { - return -__builtin_huge_val(); + return -plus_infinity(); } double NANQ(void) { - return __builtin_nan(""); +#ifdef NAN + return NAN; +#else + return sqrt(-1.0); /* Juts pick one. */ +#endif } -- cgit v1.2.3