Commit 8d6c92b6b18a95e079d340db117c77f0e01b71f1
1 parent
ce9ede84
softfloat-native: improve correctness of floatXX_is_neg()
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6059 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
3 deletions
fpu/softfloat-native.h
| ... | ... | @@ -265,7 +265,9 @@ INLINE float32 float32_is_infinity(float32 a) |
| 265 | 265 | |
| 266 | 266 | INLINE float32 float32_is_neg(float32 a) |
| 267 | 267 | { |
| 268 | - return a < 0.0; | |
| 268 | + float32u u; | |
| 269 | + u.f = a; | |
| 270 | + return u.i >> 31; | |
| 269 | 271 | } |
| 270 | 272 | |
| 271 | 273 | INLINE float32 float32_is_zero(float32 a) |
| ... | ... | @@ -372,7 +374,9 @@ INLINE float64 float64_is_infinity(float64 a) |
| 372 | 374 | |
| 373 | 375 | INLINE float64 float64_is_neg(float64 a) |
| 374 | 376 | { |
| 375 | - return a < 0.0; | |
| 377 | + float64u u; | |
| 378 | + u.f = a; | |
| 379 | + return u.i >> 63; | |
| 376 | 380 | } |
| 377 | 381 | |
| 378 | 382 | INLINE float64 float64_is_zero(float64 a) |
| ... | ... | @@ -474,7 +478,9 @@ INLINE floatx80 floatx80_is_infinity(floatx80 a) |
| 474 | 478 | |
| 475 | 479 | INLINE floatx80 floatx80_is_neg(floatx80 a) |
| 476 | 480 | { |
| 477 | - return a < 0.0; | |
| 481 | + floatx80u u; | |
| 482 | + u.f = a; | |
| 483 | + return u.i.high >> 15; | |
| 478 | 484 | } |
| 479 | 485 | |
| 480 | 486 | INLINE floatx80 floatx80_is_zero(floatx80 a) | ... | ... |