v5: * Initial. Cc: Peter Maydell <peter.mayd...@linaro.org> Signed-off-by: Andreas Färber <andreas.faer...@web.de> --- fpu/softfloat.c | 48 ++++++++++++++++++++++++------------------------ fpu/softfloat.h | 34 ++++++++++++++++------------------ 2 files changed, 40 insertions(+), 42 deletions(-)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index d1e3a42..6b2cbd7 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -159,11 +159,11 @@ static int_fast32_t roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM) | returned. *----------------------------------------------------------------------------*/ -static int64 roundAndPackInt64( flag zSign, uint64_t absZ0, uint64_t absZ1 STATUS_PARAM) +static int_fast64_t roundAndPackInt64( flag zSign, uint64_t absZ0, uint64_t absZ1 STATUS_PARAM) { int_fast8_t roundingMode; flag roundNearestEven, increment; - int64 z; + int_fast64_t z; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); @@ -660,7 +660,7 @@ static floatx80 { int_fast8_t roundingMode; flag roundNearestEven, increment, isTiny; - int64 roundIncrement, roundMask, roundBits; + int_fast64_t roundIncrement, roundMask, roundBits; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); @@ -1206,10 +1206,10 @@ float128 int32_to_float128( int_fast32_t a STATUS_PARAM ) | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -float32 int64_to_float32( int64 a STATUS_PARAM ) +float32 int64_to_float32( int_fast64_t a STATUS_PARAM ) { flag zSign; - uint64 absA; + uint_fast64_t absA; int_fast8_t shiftCount; if ( a == 0 ) return float32_zero; @@ -1232,7 +1232,7 @@ float32 int64_to_float32( int64 a STATUS_PARAM ) } -float32 uint64_to_float32( uint64 a STATUS_PARAM ) +float32 uint64_to_float32( uint_fast64_t a STATUS_PARAM ) { int_fast8_t shiftCount; @@ -1259,7 +1259,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM ) | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -float64 int64_to_float64( int64 a STATUS_PARAM ) +float64 int64_to_float64( int_fast64_t a STATUS_PARAM ) { flag zSign; @@ -1272,7 +1272,7 @@ float64 int64_to_float64( int64 a STATUS_PARAM ) } -float64 uint64_to_float64( uint64 a STATUS_PARAM ) +float64 uint64_to_float64( uint_fast64_t a STATUS_PARAM ) { if ( a == 0 ) return float64_zero; return normalizeRoundAndPackFloat64( 0, 0x43C, a STATUS_VAR ); @@ -1288,10 +1288,10 @@ float64 uint64_to_float64( uint64 a STATUS_PARAM ) | Arithmetic. *----------------------------------------------------------------------------*/ -floatx80 int64_to_floatx80( int64 a STATUS_PARAM ) +floatx80 int64_to_floatx80( int_fast64_t a STATUS_PARAM ) { flag zSign; - uint64 absA; + uint_fast64_t absA; int_fast8_t shiftCount; if ( a == 0 ) return packFloatx80( 0, 0, 0 ); @@ -1312,10 +1312,10 @@ floatx80 int64_to_floatx80( int64 a STATUS_PARAM ) | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -float128 int64_to_float128( int64 a STATUS_PARAM ) +float128 int64_to_float128( int_fast64_t a STATUS_PARAM ) { flag zSign; - uint64 absA; + uint_fast64_t absA; int_fast8_t shiftCount; int_fast32_t zExp; uint64_t zSig0, zSig1; @@ -1474,7 +1474,7 @@ int_fast16_t float32_to_int16_round_to_zero( float32 a STATUS_PARAM ) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 float32_to_int64( float32 a STATUS_PARAM ) +int_fast64_t float32_to_int64( float32 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; @@ -1511,13 +1511,13 @@ int64 float32_to_int64( float32 a STATUS_PARAM ) | returned. *----------------------------------------------------------------------------*/ -int64 float32_to_int64_round_to_zero( float32 a STATUS_PARAM ) +int_fast64_t float32_to_int64_round_to_zero( float32 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; uint32_t aSig; uint64_t aSig64; - int64 z; + int_fast64_t z; a = float32_squash_input_denormal(a STATUS_VAR); aSig = extractFloat32Frac( a ); @@ -2616,7 +2616,7 @@ int_fast16_t float64_to_int16_round_to_zero( float64 a STATUS_PARAM ) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 float64_to_int64( float64 a STATUS_PARAM ) +int_fast64_t float64_to_int64( float64 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; @@ -2659,12 +2659,12 @@ int64 float64_to_int64( float64 a STATUS_PARAM ) | returned. *----------------------------------------------------------------------------*/ -int64 float64_to_int64_round_to_zero( float64 a STATUS_PARAM ) +int_fast64_t float64_to_int64_round_to_zero( float64 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; uint64_t aSig; - int64 z; + int_fast64_t z; a = float64_squash_input_denormal(a STATUS_VAR); aSig = extractFloat64Frac( a ); @@ -3788,7 +3788,7 @@ int_fast32_t floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) | overflows, the largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 floatx80_to_int64( floatx80 a STATUS_PARAM ) +int_fast64_t floatx80_to_int64( floatx80 a STATUS_PARAM ) { flag aSign; int_fast32_t aExp, shiftCount; @@ -3828,12 +3828,12 @@ int64 floatx80_to_int64( floatx80 a STATUS_PARAM ) | sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM ) +int_fast64_t floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM ) { flag aSign; int_fast32_t aExp, shiftCount; uint64_t aSig; - int64 z; + int_fast64_t z; aSig = extractFloatx80Frac( a ); aExp = extractFloatx80Exp( a ); @@ -4786,7 +4786,7 @@ int_fast32_t float128_to_int32_round_to_zero( float128 a STATUS_PARAM ) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 float128_to_int64( float128 a STATUS_PARAM ) +int_fast64_t float128_to_int64( float128 a STATUS_PARAM ) { flag aSign; int_fast32_t aExp, shiftCount; @@ -4829,12 +4829,12 @@ int64 float128_to_int64( float128 a STATUS_PARAM ) | returned. *----------------------------------------------------------------------------*/ -int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM ) +int_fast64_t float128_to_int64_round_to_zero( float128 a STATUS_PARAM ) { flag aSign; int_fast32_t aExp, shiftCount; uint64_t aSig0, aSig1; - int64 z; + int_fast64_t z; aSig1 = extractFloat128Frac1( a ); aSig0 = extractFloat128Frac0( a ); diff --git a/fpu/softfloat.h b/fpu/softfloat.h index ce65530..f638a4d 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -54,8 +54,6 @@ these four paragraphs for those parts of this code that are retained. | to the same as `int'. *----------------------------------------------------------------------------*/ typedef uint8_t flag; -typedef uint64_t uint64; -typedef int64_t int64; #define LIT64( a ) a##LL #define INLINE static inline @@ -242,15 +240,15 @@ floatx80 int32_to_floatx80( int_fast32_t STATUS_PARAM ); #ifdef FLOAT128 float128 int32_to_float128( int_fast32_t STATUS_PARAM ); #endif -float32 int64_to_float32( int64 STATUS_PARAM ); -float32 uint64_to_float32( uint64 STATUS_PARAM ); -float64 int64_to_float64( int64 STATUS_PARAM ); -float64 uint64_to_float64( uint64 STATUS_PARAM ); +float32 int64_to_float32( int_fast64_t STATUS_PARAM ); +float32 uint64_to_float32( uint_fast64_t STATUS_PARAM ); +float64 int64_to_float64( int_fast64_t STATUS_PARAM ); +float64 uint64_to_float64( uint_fast64_t STATUS_PARAM ); #ifdef FLOATX80 -floatx80 int64_to_floatx80( int64 STATUS_PARAM ); +floatx80 int64_to_floatx80( int_fast64_t STATUS_PARAM ); #endif #ifdef FLOAT128 -float128 int64_to_float128( int64 STATUS_PARAM ); +float128 int64_to_float128( int_fast64_t STATUS_PARAM ); #endif /*---------------------------------------------------------------------------- @@ -286,8 +284,8 @@ int_fast32_t float32_to_int32( float32 STATUS_PARAM ); int_fast32_t float32_to_int32_round_to_zero( float32 STATUS_PARAM ); uint_fast32_t float32_to_uint32( float32 STATUS_PARAM ); uint_fast32_t float32_to_uint32_round_to_zero( float32 STATUS_PARAM ); -int64 float32_to_int64( float32 STATUS_PARAM ); -int64 float32_to_int64_round_to_zero( float32 STATUS_PARAM ); +int_fast64_t float32_to_int64( float32 STATUS_PARAM ); +int_fast64_t float32_to_int64_round_to_zero( float32 STATUS_PARAM ); float64 float32_to_float64( float32 STATUS_PARAM ); #ifdef FLOATX80 floatx80 float32_to_floatx80( float32 STATUS_PARAM ); @@ -396,10 +394,10 @@ int_fast32_t float64_to_int32( float64 STATUS_PARAM ); int_fast32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM ); uint_fast32_t float64_to_uint32( float64 STATUS_PARAM ); uint_fast32_t float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); -int64 float64_to_int64( float64 STATUS_PARAM ); -int64 float64_to_int64_round_to_zero( float64 STATUS_PARAM ); -uint64 float64_to_uint64 (float64 a STATUS_PARAM); -uint64 float64_to_uint64_round_to_zero (float64 a STATUS_PARAM); +int_fast64_t float64_to_int64( float64 STATUS_PARAM ); +int_fast64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM ); +uint_fast64_t float64_to_uint64 (float64 a STATUS_PARAM); +uint_fast64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM); float32 float64_to_float32( float64 STATUS_PARAM ); #ifdef FLOATX80 floatx80 float64_to_floatx80( float64 STATUS_PARAM ); @@ -501,8 +499,8 @@ INLINE float64 float64_set_sign(float64 a, int sign) *----------------------------------------------------------------------------*/ int_fast32_t floatx80_to_int32( floatx80 STATUS_PARAM ); int_fast32_t floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM ); -int64 floatx80_to_int64( floatx80 STATUS_PARAM ); -int64 floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM ); +int_fast64_t floatx80_to_int64( floatx80 STATUS_PARAM ); +int_fast64_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM ); float32 floatx80_to_float32( floatx80 STATUS_PARAM ); float64 floatx80_to_float64( floatx80 STATUS_PARAM ); #ifdef FLOAT128 @@ -584,8 +582,8 @@ INLINE int floatx80_is_any_nan(floatx80 a) *----------------------------------------------------------------------------*/ int_fast32_t float128_to_int32( float128 STATUS_PARAM ); int_fast32_t float128_to_int32_round_to_zero( float128 STATUS_PARAM ); -int64 float128_to_int64( float128 STATUS_PARAM ); -int64 float128_to_int64_round_to_zero( float128 STATUS_PARAM ); +int_fast64_t float128_to_int64( float128 STATUS_PARAM ); +int_fast64_t float128_to_int64_round_to_zero( float128 STATUS_PARAM ); float32 float128_to_float32( float128 STATUS_PARAM ); float64 float128_to_float64( float128 STATUS_PARAM ); #ifdef FLOATX80 -- 1.7.3.4