diff mbox

[2/4] fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts

Message ID 1453807806-32698-3-git-send-email-peter.maydell@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Maydell Jan. 26, 2016, 11:30 a.m. UTC
Use the plain 'int' type rather than 'int_fast16_t' for shift counts
in the various shift related functions, since we don't actually care
about the size of the integer at all here, and using int16_t would
be confusing.

This should be a safe change because int_fast16_t semantics
permit use of 'int' (and on 32-bit glibc that is what you get).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 fpu/softfloat-macros.h | 16 ++++++++--------
 fpu/softfloat.c        | 36 ++++++++++++++++++++++++------------
 2 files changed, 32 insertions(+), 20 deletions(-)
diff mbox

Patch

diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h
index e95b445..51947ef 100644
--- a/fpu/softfloat-macros.h
+++ b/fpu/softfloat-macros.h
@@ -99,7 +99,7 @@  this code that are retained.
 | The result is stored in the location pointed to by `zPtr'.
 *----------------------------------------------------------------------------*/
 
-static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
+static inline void shift32RightJamming(uint32_t a, int count, uint32_t *zPtr)
 {
     uint32_t z;
 
@@ -125,7 +125,7 @@  static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t
 | The result is stored in the location pointed to by `zPtr'.
 *----------------------------------------------------------------------------*/
 
-static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
+static inline void shift64RightJamming(uint64_t a, int count, uint64_t *zPtr)
 {
     uint64_t z;
 
@@ -161,7 +161,7 @@  static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t
 
 static inline void
  shift64ExtraRightJamming(
-     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+     uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
     uint64_t z0, z1;
     int8_t negCount = ( - count ) & 63;
@@ -198,7 +198,7 @@  static inline void
 
 static inline void
  shift128Right(
-     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+     uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
     uint64_t z0, z1;
     int8_t negCount = ( - count ) & 63;
@@ -233,7 +233,7 @@  static inline void
 
 static inline void
  shift128RightJamming(
-     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+     uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
     uint64_t z0, z1;
     int8_t negCount = ( - count ) & 63;
@@ -287,7 +287,7 @@  static inline void
      uint64_t a0,
      uint64_t a1,
      uint64_t a2,
-     int_fast16_t count,
+     int count,
      uint64_t *z0Ptr,
      uint64_t *z1Ptr,
      uint64_t *z2Ptr
@@ -342,7 +342,7 @@  static inline void
 
 static inline void
  shortShift128Left(
-     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+     uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
 
     *z1Ptr = a1<<count;
@@ -364,7 +364,7 @@  static inline void
      uint64_t a0,
      uint64_t a1,
      uint64_t a2,
-     int_fast16_t count,
+     int count,
      uint64_t *z0Ptr,
      uint64_t *z1Ptr,
      uint64_t *z2Ptr
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index fc6a160..89e6fd9 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1544,7 +1544,8 @@  float128 uint64_to_float128(uint64_t a, float_status *status)
 int32_t float32_to_int32(float32 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint32_t aSig;
     uint64_t aSig64;
 
@@ -1575,7 +1576,8 @@  int32_t float32_to_int32(float32 a, float_status *status)
 int32_t float32_to_int32_round_to_zero(float32 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint32_t aSig;
     int32_t z;
     a = float32_squash_input_denormal(a, status);
@@ -1620,7 +1622,8 @@  int32_t float32_to_int32_round_to_zero(float32 a, float_status *status)
 int16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint32_t aSig;
     int32_t z;
 
@@ -1669,7 +1672,8 @@  int16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
 int64_t float32_to_int64(float32 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint32_t aSig;
     uint64_t aSig64, aSigExtra;
     a = float32_squash_input_denormal(a, status);
@@ -1708,7 +1712,8 @@  int64_t float32_to_int64(float32 a, float_status *status)
 uint64_t float32_to_uint64(float32 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint32_t aSig;
     uint64_t aSig64, aSigExtra;
     a = float32_squash_input_denormal(a, status);
@@ -1772,7 +1777,8 @@  uint64_t float32_to_uint64_round_to_zero(float32 a, float_status *status)
 int64_t float32_to_int64_round_to_zero(float32 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint32_t aSig;
     uint64_t aSig64;
     int64_t z;
@@ -3076,7 +3082,8 @@  int float32_unordered_quiet(float32 a, float32 b, float_status *status)
 int32_t float64_to_int32(float64 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint64_t aSig;
     a = float64_squash_input_denormal(a, status);
 
@@ -3104,7 +3111,8 @@  int32_t float64_to_int32(float64 a, float_status *status)
 int32_t float64_to_int32_round_to_zero(float64 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint64_t aSig, savedASig;
     int32_t z;
     a = float64_squash_input_denormal(a, status);
@@ -3153,7 +3161,8 @@  int32_t float64_to_int32_round_to_zero(float64 a, float_status *status)
 int16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint64_t aSig, savedASig;
     int32_t z;
 
@@ -3204,7 +3213,8 @@  int16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
 int64_t float64_to_int64(float64 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint64_t aSig, aSigExtra;
     a = float64_squash_input_denormal(a, status);
 
@@ -3247,7 +3257,8 @@  int64_t float64_to_int64(float64 a, float_status *status)
 int64_t float64_to_int64_round_to_zero(float64 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint64_t aSig;
     int64_t z;
     a = float64_squash_input_denormal(a, status);
@@ -7285,7 +7296,8 @@  uint16_t float64_to_uint16_round_to_zero(float64 a, float_status *status)
 uint64_t float64_to_uint64(float64 a, float_status *status)
 {
     flag aSign;
-    int_fast16_t aExp, shiftCount;
+    int_fast16_t aExp;
+    int shiftCount;
     uint64_t aSig, aSigExtra;
     a = float64_squash_input_denormal(a, status);