Revision 1b2b0af5
b/fpu/softfloat-native.c | ||
---|---|---|
23 | 23 |
#endif |
24 | 24 |
|
25 | 25 |
#if defined(_BSD) |
26 |
#define lrint(d) ((int32_t)rint(d))
|
|
27 |
#define llrint(d) ((int64_t)rint(d))
|
|
26 |
#define lrint(d) ((long)rint(d))
|
|
27 |
#define llrint(d) ((long long)rint(d))
|
|
28 | 28 |
#endif |
29 | 29 |
|
30 | 30 |
#if defined(__powerpc__) |
... | ... | |
80 | 80 |
} |
81 | 81 |
#endif |
82 | 82 |
|
83 |
/* XXX: this code implements the x86 behaviour, not the IEEE one. */ |
|
84 |
#if HOST_LONG_BITS == 32 |
|
85 |
static inline int long_to_int32(long a) |
|
86 |
{ |
|
87 |
return a; |
|
88 |
} |
|
89 |
#else |
|
90 |
static inline int long_to_int32(long a) |
|
91 |
{ |
|
92 |
if (a != (int32_t)a) |
|
93 |
a = 0x80000000; |
|
94 |
return a; |
|
95 |
} |
|
96 |
#endif |
|
97 |
|
|
83 | 98 |
/*---------------------------------------------------------------------------- |
84 | 99 |
| Software IEC/IEEE single-precision conversion routines. |
85 | 100 |
*----------------------------------------------------------------------------*/ |
86 | 101 |
int float32_to_int32( float32 a STATUS_PARAM) |
87 | 102 |
{ |
88 |
return lrintf(a);
|
|
103 |
return long_to_int32(lrintf(a));
|
|
89 | 104 |
} |
90 | 105 |
int float32_to_int32_round_to_zero( float32 a STATUS_PARAM) |
91 | 106 |
{ |
... | ... | |
167 | 182 |
*----------------------------------------------------------------------------*/ |
168 | 183 |
int float64_to_int32( float64 a STATUS_PARAM) |
169 | 184 |
{ |
170 |
return lrint(a);
|
|
185 |
return long_to_int32(lrint(a));
|
|
171 | 186 |
} |
172 | 187 |
int float64_to_int32_round_to_zero( float64 a STATUS_PARAM) |
173 | 188 |
{ |
... | ... | |
276 | 291 |
*----------------------------------------------------------------------------*/ |
277 | 292 |
int floatx80_to_int32( floatx80 a STATUS_PARAM) |
278 | 293 |
{ |
279 |
return lrintl(a);
|
|
294 |
return long_to_int32(lrintl(a));
|
|
280 | 295 |
} |
281 | 296 |
int floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM) |
282 | 297 |
{ |
Also available in: Unified diff