Give the previously unnamed enum a typedef name. Use the packed
attribute so that we do not affect the layout of the float_status
struct. Use it in the prototypes of relevant functions.
Adjust switch statements as necessary to avoid compiler warnings.
Signed-off-by: Richard Henderson <address@hidden>
---
include/fpu/softfloat-helpers.h | 5 +--
include/fpu/softfloat-types.h | 6 ++--
include/fpu/softfloat.h | 39 +++++++++++-----------
fpu/softfloat.c | 57 ++++++++++++++++++++-------------
target/arm/vfp_helper.c | 4 +--
target/m68k/fpu_helper.c | 6 ++--
6 files changed, 66 insertions(+), 51 deletions(-)
diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h
index 40d32a6d5d..735ed6b653 100644
--- a/include/fpu/softfloat-helpers.h
+++ b/include/fpu/softfloat-helpers.h
@@ -58,7 +58,8 @@ static inline void set_float_detect_tininess(bool val,
float_status *status)
status->tininess_before_rounding = val;
}
-static inline void set_float_rounding_mode(int val, float_status *status)
+static inline void set_float_rounding_mode(FloatRoundMode val,
+ float_status *status)
{
status->float_rounding_mode = val;
}
@@ -99,7 +100,7 @@ static inline bool get_float_detect_tininess(float_status
*status)
return status->tininess_before_rounding;
}
-static inline int get_float_rounding_mode(float_status *status)
+static inline FloatRoundMode get_float_rounding_mode(float_status *status)
{
return status->float_rounding_mode;
}
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
index 874ddd9f93..7680193ebc 100644
--- a/include/fpu/softfloat-types.h
+++ b/include/fpu/softfloat-types.h
@@ -123,7 +123,7 @@ typedef struct {
*Software IEC/IEEE floating-point rounding mode.
*/
-enum {
+typedef enum __attribute__((__packed__)) {
float_round_nearest_even = 0,
float_round_down = 1,
float_round_up = 2,
@@ -131,7 +131,7 @@ enum {
float_round_ties_away = 4,
/* Not an IEEE rounding mode: round to the closest odd mantissa value */
float_round_to_odd = 5,
-};
+} FloatRoundMode;