diff mbox

[v2,3/4] softfloat: Replace uint16 type with uint_fast16_t

Message ID 1335392156-13616-4-git-send-email-andreas.faerber@web.de
State New
Headers show

Commit Message

Andreas Färber April 25, 2012, 10:15 p.m. UTC
From: Andreas Färber <afaerber@suse.de>

Based on the following Coccinelle patch:

@@
typedef uint16, uint_fast16_t;
@@
-uint16
+uint_fast16_t

Fixes the build of the Cocoa frontend on Mac OS X and avoids a
workaround for AIX.

For pre-10 Solaris include osdep.h.

Reported-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Reported-by: Rui Carmo <rui.carmo@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Juan Pineda <juan@logician.com>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat.c |    8 ++++----
 fpu/softfloat.h |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Peter Maydell April 26, 2012, 4:10 p.m. UTC | #1
On 25 April 2012 23:15, Andreas Färber <andreas.faerber@web.de> wrote:
> From: Andreas Färber <afaerber@suse.de>
>
> Based on the following Coccinelle patch:
>
> @@
> typedef uint16, uint_fast16_t;
> @@
> -uint16
> +uint_fast16_t
>
> Fixes the build of the Cocoa frontend on Mac OS X and avoids a
> workaround for AIX.
>
> For pre-10 Solaris include osdep.h.
>
> Reported-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> Reported-by: Rui Carmo <rui.carmo@gmail.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Juan Pineda <juan@logician.com>
> Cc: malc <av1474@comtv.ru>
> Cc: Ben Taylor <bentaylor.solx86@gmail.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

This is a safe change, because the uint16 type is used only
in a couple of functions which are only used by the ARM
target, and I've thrown a pile of tests at it to confirm
that this is still generating correct results.

-- PMM
malc April 26, 2012, 4:29 p.m. UTC | #2
On Thu, 26 Apr 2012, Peter Maydell wrote:

> On 25 April 2012 23:15, Andreas F?rber <andreas.faerber@web.de> wrote:
> > From: Andreas F?rber <afaerber@suse.de>
> >
> > Based on the following Coccinelle patch:
> >
> > @@
> > typedef uint16, uint_fast16_t;
> > @@
> > -uint16
> > +uint_fast16_t
> >
> > Fixes the build of the Cocoa frontend on Mac OS X and avoids a
> > workaround for AIX.
> >
> > For pre-10 Solaris include osdep.h.
> >
> > Reported-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
> > Reported-by: Rui Carmo <rui.carmo@gmail.com>
> > Signed-off-by: Andreas F?rber <afaerber@suse.de>
> > Cc: Juan Pineda <juan@logician.com>
> > Cc: malc <av1474@comtv.ru>
> > Cc: Ben Taylor <bentaylor.solx86@gmail.com>
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> This is a safe change, because the uint16 type is used only
> in a couple of functions which are only used by the ARM
> target, and I've thrown a pile of tests at it to confirm
> that this is still generating correct results.
> 

And i no longer have access to an AIX box, so fine by me.
diff mbox

Patch

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index a1c658e..50fce01 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -6443,10 +6443,10 @@  uint32 float32_to_uint32_round_to_zero( float32 a STATUS_PARAM )
     return res;
 }
 
-uint16 float32_to_uint16_round_to_zero( float32 a STATUS_PARAM )
+uint_fast16_t float32_to_uint16_round_to_zero(float32 a STATUS_PARAM)
 {
     int64_t v;
-    uint16 res;
+    uint_fast16_t res;
 
     v = float32_to_int64_round_to_zero(a STATUS_VAR);
     if (v < 0) {
@@ -6497,10 +6497,10 @@  uint32 float64_to_uint32_round_to_zero( float64 a STATUS_PARAM )
     return res;
 }
 
-uint16 float64_to_uint16_round_to_zero( float64 a STATUS_PARAM )
+uint_fast16_t float64_to_uint16_round_to_zero(float64 a STATUS_PARAM)
 {
     int64_t v;
-    uint16 res;
+    uint_fast16_t res;
 
     v = float64_to_int64_round_to_zero(a STATUS_VAR);
     if (v < 0) {
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 2ce4110..75246c4 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -44,6 +44,7 @@  these four paragraphs for those parts of this code that are retained.
 
 #include <inttypes.h>
 #include "config-host.h"
+#include "osdep.h"
 
 /*----------------------------------------------------------------------------
 | Each of the following `typedef's defines the most convenient type that holds
@@ -57,7 +58,6 @@  typedef uint8_t flag;
 typedef uint8_t uint8;
 typedef int8_t int8;
 #ifndef _AIX
-typedef int uint16;
 typedef int int16;
 #endif
 typedef unsigned int uint32;
@@ -263,7 +263,7 @@  extern const float16 float16_default_nan;
 | Software IEC/IEEE single-precision conversion routines.
 *----------------------------------------------------------------------------*/
 int16 float32_to_int16_round_to_zero( float32 STATUS_PARAM );
-uint16 float32_to_uint16_round_to_zero( float32 STATUS_PARAM );
+uint_fast16_t float32_to_uint16_round_to_zero(float32 STATUS_PARAM);
 int32 float32_to_int32( float32 STATUS_PARAM );
 int32 float32_to_int32_round_to_zero( float32 STATUS_PARAM );
 uint32 float32_to_uint32( float32 STATUS_PARAM );
@@ -367,7 +367,7 @@  extern const float32 float32_default_nan;
 | Software IEC/IEEE double-precision conversion routines.
 *----------------------------------------------------------------------------*/
 int16 float64_to_int16_round_to_zero( float64 STATUS_PARAM );
-uint16 float64_to_uint16_round_to_zero( float64 STATUS_PARAM );
+uint_fast16_t float64_to_uint16_round_to_zero(float64 STATUS_PARAM);
 int32 float64_to_int32( float64 STATUS_PARAM );
 int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM );
 uint32 float64_to_uint32( float64 STATUS_PARAM );