diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2015-02-28 17:33:03 -0800 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2015-02-28 17:33:03 -0800 |
commit | a4ae7da6ef0c09c2616a0b82f7f569e4e134f75c (patch) | |
tree | 5f01a743a211a5b7b3bacf6b53821a2bcef8295c /softfloat | |
parent | 5c8645013001ff125f9b28e0f861328e9b9a4d12 (diff) | |
download | pk-a4ae7da6ef0c09c2616a0b82f7f569e4e134f75c.zip pk-a4ae7da6ef0c09c2616a0b82f7f569e4e134f75c.tar.gz pk-a4ae7da6ef0c09c2616a0b82f7f569e4e134f75c.tar.bz2 |
Fix softfloat float->int corner cases
Diffstat (limited to 'softfloat')
-rwxr-xr-x | softfloat/f32_to_i32.c | 1 | ||||
-rwxr-xr-x | softfloat/f32_to_i64.c | 2 | ||||
-rwxr-xr-x | softfloat/f64_to_i32.c | 1 | ||||
-rwxr-xr-x | softfloat/f64_to_i64.c | 2 |
4 files changed, 1 insertions, 5 deletions
diff --git a/softfloat/f32_to_i32.c b/softfloat/f32_to_i32.c index bbbaee0..98c67c9 100755 --- a/softfloat/f32_to_i32.c +++ b/softfloat/f32_to_i32.c @@ -21,7 +21,6 @@ int_fast32_t f32_to_i32( float32_t a, int_fast8_t roundingMode, bool exact ) sign = signF32UI( uiA );
exp = expF32UI( uiA );
sig = fracF32UI( uiA );
- if ( ( exp == 0xFF ) && sig ) sign = 0;
if ( exp ) sig |= 0x00800000;
sig64 = (uint_fast64_t) sig<<32;
shiftCount = 0xAF - exp;
diff --git a/softfloat/f32_to_i64.c b/softfloat/f32_to_i64.c index c0b8981..34f877f 100755 --- a/softfloat/f32_to_i64.c +++ b/softfloat/f32_to_i64.c @@ -25,7 +25,7 @@ int_fast64_t f32_to_i64( float32_t a, int_fast8_t roundingMode, bool exact ) shiftCount = 0xBE - exp;
if ( shiftCount < 0 ) {
softfloat_raiseFlags( softfloat_flag_invalid );
- if ( ! sign || ( ( exp == 0xFF ) && sig ) ) {
+ if ( ! sign ) {
return INT64_C( 0x7FFFFFFFFFFFFFFF );
}
return - INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1;
diff --git a/softfloat/f64_to_i32.c b/softfloat/f64_to_i32.c index 0778a86..8259ee2 100755 --- a/softfloat/f64_to_i32.c +++ b/softfloat/f64_to_i32.c @@ -20,7 +20,6 @@ int_fast32_t f64_to_i32( float64_t a, int_fast8_t roundingMode, bool exact ) sign = signF64UI( uiA );
exp = expF64UI( uiA );
sig = fracF64UI( uiA );
- if ( ( exp == 0x7FF ) && sig ) sign = 0;
if ( exp ) sig |= UINT64_C( 0x0010000000000000 );
shiftCount = 0x42C - exp;
if ( 0 < shiftCount ) sig = softfloat_shift64RightJam( sig, shiftCount );
diff --git a/softfloat/f64_to_i64.c b/softfloat/f64_to_i64.c index 89663ee..0e6ddcd 100755 --- a/softfloat/f64_to_i64.c +++ b/softfloat/f64_to_i64.c @@ -28,8 +28,6 @@ int_fast64_t f64_to_i64( float64_t a, int_fast8_t roundingMode, bool exact ) softfloat_raiseFlags( softfloat_flag_invalid );
return
! sign
- || ( ( exp == 0x7FF )
- && ( sig != UINT64_C( 0x0010000000000000 ) ) )
? INT64_C( 0x7FFFFFFFFFFFFFFF )
: - INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1;
}
|