~ubuntu-branches/ubuntu/edgy/qemu/edgy

« back to all changes in this revision

Viewing changes to fpu/softfloat-native.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-08-04 22:50:15 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060804225015-g0tvbozshau6e1oo
Tags: 0.8.2-0ubuntu1
* Merged with Debian unstable
* New Upstream release
* Dropped debian/patches/12_signal_powerpc_support.patch (broken for qemu
  0.8.2)
* Redid debian/patches/21_net_sockopt.patch
* Redid debian/patches/35_syscall_sockaddr.patch
* Redid debian/patches/42_arm_tls.patch
* Dropped debian/patches/50_missing_keycodes.patch (applied upstream)
* Redid debian/patches/61_safe_64bit_int.patch
* Dropped debian/patches/63_sparc_build.patch (applied upstream)
* Added new patch 65_no-linux_types_h.patch (unnecessary kernel header
  breaking compilation of linux-user/syscall.c)
* Added new patch 66_no-linux_compiler_h.patch (unnecessary kernel header
  breaking compilation of linux-usb.c)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
void set_float_rounding_mode(int val STATUS_PARAM)
7
7
{
8
8
    STATUS(float_rounding_mode) = val;
9
 
#if defined(_BSD) && !defined(__APPLE__)
 
9
#if defined(_BSD) && !defined(__APPLE__) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10)
10
10
    fpsetround(val);
11
11
#elif defined(__arm__)
12
12
    /* nothing to do */
22
22
}
23
23
#endif
24
24
 
25
 
#if defined(_BSD)
 
25
#if defined(_BSD) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10)
26
26
#define lrint(d)                ((int32_t)rint(d))
27
27
#define llrint(d)               ((int64_t)rint(d))
 
28
#define lrintf(f)               ((int32_t)rint(f))
 
29
#define llrintf(f)              ((int64_t)rint(f))
 
30
#define sqrtf(f)                ((float)sqrt(f))
 
31
#define remainderf(fa, fb)      ((float)remainder(fa, fb))
 
32
#define rintf(f)                ((float)rint(f))
28
33
#endif
29
34
 
30
35
#if defined(__powerpc__)
80
85
}
81
86
#endif
82
87
 
 
88
/* XXX: this code implements the x86 behaviour, not the IEEE one.  */
 
89
#if HOST_LONG_BITS == 32
 
90
static inline int long_to_int32(long a)
 
91
{
 
92
    return a;
 
93
}
 
94
#else
 
95
static inline int long_to_int32(long a)
 
96
{
 
97
    if (a != (int32_t)a) 
 
98
        a = 0x80000000;
 
99
    return a;
 
100
}
 
101
#endif
 
102
 
83
103
/*----------------------------------------------------------------------------
84
104
| Software IEC/IEEE single-precision conversion routines.
85
105
*----------------------------------------------------------------------------*/
86
106
int float32_to_int32( float32 a STATUS_PARAM)
87
107
{
88
 
    return lrintf(a);
 
108
    return long_to_int32(lrintf(a));
89
109
}
90
110
int float32_to_int32_round_to_zero( float32 a STATUS_PARAM)
91
111
{
167
187
*----------------------------------------------------------------------------*/
168
188
int float64_to_int32( float64 a STATUS_PARAM)
169
189
{
170
 
    return lrint(a);
 
190
    return long_to_int32(lrint(a));
171
191
}
172
192
int float64_to_int32_round_to_zero( float64 a STATUS_PARAM)
173
193
{
276
296
*----------------------------------------------------------------------------*/
277
297
int floatx80_to_int32( floatx80 a STATUS_PARAM)
278
298
{
279
 
    return lrintl(a);
 
299
    return long_to_int32(lrintl(a));
280
300
}
281
301
int floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM)
282
302
{