Skip to contentSkip to conversation

Patch: trunc undefined in Solaris 9/Sparc

Qemu-devel Ben Taylor 1 participant 1 message Mar 7, 2007

lore
Share & tools
lore

Ben Taylor

author
#0 lore raw

This fix was suggested by Juergen Kiel, and appears to work on my Solaris 9/Sparc V490.

softfloat-native.c 2007-03-07 07:30:44.595051000 -0500 renamed from softfloat-native.c.ORIG 2007-03-07 07:30:28.662257000 -0500 +6 -0
@@ -221,6 +221,12 @@
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE double-precision operations.
 *----------------------------------------------------------------------------*/
+#if ( defined(__sun__) && ( HOST_SOLARIS < 10 ))
+double trunc(double x)
+{
+        return x < 0 ? -floor(-x) : floor(x);
+}
+#endif
 float64 float64_trunc_to_int( float64 a STATUS_PARAM )
 {
     return trunc(a);