qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/10] softfloat: Name rounding mode enum


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 04/10] softfloat: Name rounding mode enum
Date: Sat, 16 May 2020 07:30:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 5/15/20 9:01 PM, Richard Henderson wrote:
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;
[...]

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]