mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
softfloat: Replace flag with bool
We have had this on the to-do list for quite some time. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
b240c9c497
commit
c120391c00
10 changed files with 174 additions and 190 deletions
|
@ -74,22 +74,22 @@ static inline void set_floatx80_rounding_precision(int val,
|
|||
status->floatx80_rounding_precision = val;
|
||||
}
|
||||
|
||||
static inline void set_flush_to_zero(flag val, float_status *status)
|
||||
static inline void set_flush_to_zero(bool val, float_status *status)
|
||||
{
|
||||
status->flush_to_zero = val;
|
||||
}
|
||||
|
||||
static inline void set_flush_inputs_to_zero(flag val, float_status *status)
|
||||
static inline void set_flush_inputs_to_zero(bool val, float_status *status)
|
||||
{
|
||||
status->flush_inputs_to_zero = val;
|
||||
}
|
||||
|
||||
static inline void set_default_nan_mode(flag val, float_status *status)
|
||||
static inline void set_default_nan_mode(bool val, float_status *status)
|
||||
{
|
||||
status->default_nan_mode = val;
|
||||
}
|
||||
|
||||
static inline void set_snan_bit_is_one(flag val, float_status *status)
|
||||
static inline void set_snan_bit_is_one(bool val, float_status *status)
|
||||
{
|
||||
status->snan_bit_is_one = val;
|
||||
}
|
||||
|
@ -114,17 +114,17 @@ static inline int get_floatx80_rounding_precision(float_status *status)
|
|||
return status->floatx80_rounding_precision;
|
||||
}
|
||||
|
||||
static inline flag get_flush_to_zero(float_status *status)
|
||||
static inline bool get_flush_to_zero(float_status *status)
|
||||
{
|
||||
return status->flush_to_zero;
|
||||
}
|
||||
|
||||
static inline flag get_flush_inputs_to_zero(float_status *status)
|
||||
static inline bool get_flush_inputs_to_zero(float_status *status)
|
||||
{
|
||||
return status->flush_inputs_to_zero;
|
||||
}
|
||||
|
||||
static inline flag get_default_nan_mode(float_status *status)
|
||||
static inline bool get_default_nan_mode(float_status *status)
|
||||
{
|
||||
return status->default_nan_mode;
|
||||
}
|
||||
|
|
|
@ -756,11 +756,9 @@ static inline uint32_t estimateSqrt32(int aExp, uint32_t a)
|
|||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline bool eq128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
|
||||
{
|
||||
|
||||
return ( a0 == b0 ) && ( a1 == b1 );
|
||||
|
||||
return a0 == b0 && a1 == b1;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
@ -769,11 +767,9 @@ static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
|||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline bool le128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
|
||||
|
||||
return a0 < b0 || (a0 == b0 && a1 <= b1);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
@ -782,11 +778,9 @@ static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
|||
| returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline bool lt128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
|
||||
|
||||
return a0 < b0 || (a0 == b0 && a1 < b1);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
@ -795,11 +789,9 @@ static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
|||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
static inline bool ne128(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1)
|
||||
{
|
||||
|
||||
return ( a0 != b0 ) || ( a1 != b1 );
|
||||
|
||||
return a0 != b0 || a1 != b1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -80,12 +80,6 @@ this code that are retained.
|
|||
#ifndef SOFTFLOAT_TYPES_H
|
||||
#define SOFTFLOAT_TYPES_H
|
||||
|
||||
/* This 'flag' type must be able to hold at least 0 and 1. It should
|
||||
* probably be replaced with 'bool' but the uses would need to be audited
|
||||
* to check that they weren't accidentally relying on it being a larger type.
|
||||
*/
|
||||
typedef uint8_t flag;
|
||||
|
||||
/*
|
||||
* Software IEC/IEEE floating-point types.
|
||||
*/
|
||||
|
@ -169,12 +163,12 @@ typedef struct float_status {
|
|||
uint8_t float_exception_flags;
|
||||
signed char floatx80_rounding_precision;
|
||||
/* should denormalised results go to zero and set the inexact flag? */
|
||||
flag flush_to_zero;
|
||||
bool flush_to_zero;
|
||||
/* should denormalised inputs go to zero and set the input_denormal flag? */
|
||||
flag flush_inputs_to_zero;
|
||||
flag default_nan_mode;
|
||||
bool flush_inputs_to_zero;
|
||||
bool default_nan_mode;
|
||||
/* not always used -- see snan_bit_is_one() in softfloat-specialize.h */
|
||||
flag snan_bit_is_one;
|
||||
bool snan_bit_is_one;
|
||||
} float_status;
|
||||
|
||||
#endif /* SOFTFLOAT_TYPES_H */
|
||||
|
|
|
@ -440,7 +440,7 @@ static inline float32 float32_set_sign(float32 a, int sign)
|
|||
| significand.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline float32 packFloat32(flag zSign, int zExp, uint32_t zSig)
|
||||
static inline float32 packFloat32(bool zSign, int zExp, uint32_t zSig)
|
||||
{
|
||||
return make_float32(
|
||||
(((uint32_t)zSign) << 31) + (((uint32_t)zExp) << 23) + zSig);
|
||||
|
@ -722,7 +722,7 @@ static inline int32_t extractFloatx80Exp(floatx80 a)
|
|||
| `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag extractFloatx80Sign(floatx80 a)
|
||||
static inline bool extractFloatx80Sign(floatx80 a)
|
||||
{
|
||||
return a.high >> 15;
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ static inline flag extractFloatx80Sign(floatx80 a)
|
|||
| extended double-precision floating-point value, returning the result.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline floatx80 packFloatx80(flag zSign, int32_t zExp, uint64_t zSig)
|
||||
static inline floatx80 packFloatx80(bool zSign, int32_t zExp, uint64_t zSig)
|
||||
{
|
||||
floatx80 z;
|
||||
|
||||
|
@ -783,7 +783,7 @@ floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status);
|
|||
| Floating-Point Arithmetic.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign,
|
||||
floatx80 roundAndPackFloatx80(int8_t roundingPrecision, bool zSign,
|
||||
int32_t zExp, uint64_t zSig0, uint64_t zSig1,
|
||||
float_status *status);
|
||||
|
||||
|
@ -797,7 +797,7 @@ floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign,
|
|||
*----------------------------------------------------------------------------*/
|
||||
|
||||
floatx80 normalizeRoundAndPackFloatx80(int8_t roundingPrecision,
|
||||
flag zSign, int32_t zExp,
|
||||
bool zSign, int32_t zExp,
|
||||
uint64_t zSig0, uint64_t zSig1,
|
||||
float_status *status);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue