More Solaris fixes

This commit is contained in:
antirez 2009-10-27 18:38:25 +01:00
parent d7f43c081a
commit 5043dff351
2 changed files with 19 additions and 0 deletions

View File

@ -58,6 +58,9 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <limits.h> #include <limits.h>
#include <math.h> #include <math.h>
#if defined(__sun) && defined(__GNUC__)
#include "solarisfixes.h"
#endif
#include "redis.h" #include "redis.h"
#include "ae.h" /* Event driven programming library */ #include "ae.h" /* Event driven programming library */

16
solarisfixes.h Normal file
View File

@ -0,0 +1,16 @@
/* Solaris specific fixes */
#undef isnan
#define isnan(x) \
__extension__({ __typeof (x) __x_a = (x); \
__builtin_expect(__x_a != __x_a, 0); })
#undef isfinite
#define isfinite(x) \
__extension__ ({ __typeof (x) __x_f = (x); \
__builtin_expect(!isnan(__x_f - __x_f), 1); })
#undef isinf
#define isinf(x) \
__extension__ ({ __typeof (x) __x_i = (x); \
__builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); })