Subject: Re: pkg/36602: qemu does not compile on NetBSD before 4.0
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Pierre Pronchery <khorben@defora.org>
List: pkgsrc-bugs
Date: 07/04/2007 02:15:10
The following reply was made to PR pkg/36602; it has been noted by GNATS.
From: Pierre Pronchery <khorben@defora.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/36602: qemu does not compile on NetBSD before 4.0
Date: Wed, 04 Jul 2007 06:13:35 +0200
This is a multi-part message in MIME format.
--------------040502010003000302010607
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hello again,
my quick-and-dirty patch is attached here.
HTH,
--
khorben
--------------040502010003000302010607
Content-Type: text/plain;
name="qemu.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="qemu.diff"
--- qemu-0.9.0/fpu/softfloat-native.c 2007-07-04 06:08:04.000000000 +0200
+++ qemu-0.9.0/fpu/softfloat-native.c.orig 2007-07-04 06:09:20.000000000 +0200
@@ -221,66 +221,9 @@
/*----------------------------------------------------------------------------
| Software IEC/IEEE double-precision operations.
*----------------------------------------------------------------------------*/
-#include <sys/types.h>
-
-static const double huge = 1.0e300;
-
-typedef union
+float64 float64_trunc_to_int( float64 a STATUS_PARAM )
{
- double value;
- struct
- {
- u_int32_t msw;
- u_int32_t lsw;
- } parts;
-} ieee_double_shape_type;
-
-#define EXTRACT_WORDS(ix0,ix1,d) \
-do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.parts.msw; \
- (ix1) = ew_u.parts.lsw; \
-} while (0)
-
-#define INSERT_WORDS(d,ix0,ix1) \
-do { \
- ieee_double_shape_type iw_u; \
- iw_u.parts.msw = (ix0); \
- iw_u.parts.lsw = (ix1); \
- (d) = iw_u.value; \
-} while (0)
-
-float64 float64_trunc_to_int( float64 x STATUS_PARAM )
-{
- int32_t i0,i1,j0;
- uint32_t i;
- EXTRACT_WORDS(i0,i1,x);
- j0 = ((i0>>20)&0x7ff)-0x3ff;
- if(j0<20) {
- if(j0<0) { /* raise inexact if x != 0 */
- if(huge+x>0.0) {/* |x|<1, so return 0*sign(x) */
- i0 &= 0x80000000U;
- i1 = 0;
- }
- } else {
- i = (0x000fffff)>>j0;
- if(((i0&i)|i1)==0) return x; /* x is integral */
- if(huge+x>0.0) { /* raise inexact flag */
- i0 &= (~i); i1=0;
- }
- }
- } else if (j0>51) {
- if(j0==0x400) return x+x; /* inf or NaN */
- else return x; /* x is integral */
- } else {
- i = ((u_int32_t)(0xffffffff))>>(j0-20);
- if((i1&i)==0) return x; /* x is integral */
- if(huge+x>0.0) /* raise inexact flag */
- i1 &= (~i);
- }
- INSERT_WORDS(x,i0,i1);
- return x;
+ return trunc(a);
}
float64 float64_round_to_int( float64 a STATUS_PARAM )
--------------040502010003000302010607--