]> git.saurik.com Git - redis.git/commitdiff
More Solaris fixes
authorantirez <antirez@gmail.com>
Tue, 27 Oct 2009 17:38:25 +0000 (18:38 +0100)
committerantirez <antirez@gmail.com>
Tue, 27 Oct 2009 17:38:25 +0000 (18:38 +0100)
redis.c
solarisfixes.h [new file with mode: 0644]

diff --git a/redis.c b/redis.c
index eb44138f3a97aa9951046696065616cbef533914..e26e676f64cdd397ac706dcb2514a4a34264952b 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -58,6 +58,9 @@
 #include <sys/resource.h>
 #include <limits.h>
 #include <math.h>
+#if defined(__sun) && defined(__GNUC__)
+#include "solarisfixes.h"
+#endif
 
 #include "redis.h"
 #include "ae.h"     /* Event driven programming library */
diff --git a/solarisfixes.h b/solarisfixes.h
new file mode 100644 (file)
index 0000000..36f1920
--- /dev/null
@@ -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); })