Commit 629bd74a4fcb68dbec658da455fa1143315ec646
1 parent
3f911a51
softfloat-native: add float32_is_nan()
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6002 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
10 additions
and
0 deletions
fpu/softfloat-native.c
| @@ -250,6 +250,15 @@ int float32_is_signaling_nan( float32 a1) | @@ -250,6 +250,15 @@ int float32_is_signaling_nan( float32 a1) | ||
| 250 | return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF ); | 250 | return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF ); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | +int float32_is_nan( float32 a1 ) | ||
| 254 | +{ | ||
| 255 | + float32u u; | ||
| 256 | + uint64_t a; | ||
| 257 | + u.f = a1; | ||
| 258 | + a = u.i; | ||
| 259 | + return ( 0xFF800000 < ( a<<1 ) ); | ||
| 260 | +} | ||
| 261 | + | ||
| 253 | /*---------------------------------------------------------------------------- | 262 | /*---------------------------------------------------------------------------- |
| 254 | | Software IEC/IEEE double-precision conversion routines. | 263 | | Software IEC/IEEE double-precision conversion routines. |
| 255 | *----------------------------------------------------------------------------*/ | 264 | *----------------------------------------------------------------------------*/ |
fpu/softfloat-native.h
| @@ -246,6 +246,7 @@ INLINE int float32_unordered( float32 a, float32 b STATUS_PARAM) | @@ -246,6 +246,7 @@ INLINE int float32_unordered( float32 a, float32 b STATUS_PARAM) | ||
| 246 | int float32_compare( float32, float32 STATUS_PARAM ); | 246 | int float32_compare( float32, float32 STATUS_PARAM ); |
| 247 | int float32_compare_quiet( float32, float32 STATUS_PARAM ); | 247 | int float32_compare_quiet( float32, float32 STATUS_PARAM ); |
| 248 | int float32_is_signaling_nan( float32 ); | 248 | int float32_is_signaling_nan( float32 ); |
| 249 | +int float32_is_nan( float32 ); | ||
| 249 | 250 | ||
| 250 | INLINE float32 float32_abs(float32 a) | 251 | INLINE float32 float32_abs(float32 a) |
| 251 | { | 252 | { |