Skip to contentSkip to conversation

PATCH: updated Solaris isinf support

Qemu-devel Ben Taylor 1 participant 1 message Apr 13, 2007

lore
Share & tools
lore

Ben Taylor

author
#0 lore raw

This is an update to a previous patch to fix the missing macro isinf (and isnan) for Solaris that is used in target-i386/helper.c. This patch is against qemu/fpu/softfloat-native.h, which is a better place for the macro, as opposed to putting it in target-i386/helper.c.

Attribution to Juergen Keil for extending the original idea, with help from autoconf documentation.

Eventually, Solaris 10/11 will correctly support isinf, but until the updates are made, this will work for now.

Ben

fpu/softfloat-native.h +23 -0
@@ -33,6 +33,29 @@
 #define isunordered(x,y)        unordered(x, y)
 #endif
 
+#if defined(__sun__) && !defined(NEED_LIBSUNMATH)
+
+#ifndef isnan
+# define isnan(x) \
+    (sizeof (x) == sizeof (long double) ? isnan_ld (x) \
+     : sizeof (x) == sizeof (double) ? isnan_d (x) \
+     : isnan_f (x))
+static inline int isnan_f  (float       x) { return x != x; }
+static inline int isnan_d  (double      x) { return x != x; }
+static inline int isnan_ld (long double x) { return x != x; }
+#endif
+
+#ifndef isinf
+# define isinf(x) \
+    (sizeof (x) == sizeof (long double) ? isinf_ld (x) \
+     : sizeof (x) == sizeof (double) ? isinf_d (x) \
+     : isinf_f (x))
+static inline int isinf_f  (float       x) { return isnan (x - x); }
+static inline int isinf_d  (double      x) { return isnan (x - x); }
+static inline int isinf_ld (long double x) { return isnan (x - x); }
+#endif
+#endif
+
 typedef float float32;
 typedef double float64;
 #ifdef FLOATX80