diff mbox

[v2] softfloat: Fix function signature mismatches by using POSIX integer types

Message ID 1292625556-24825-1-git-send-email-andreas.faerber@web.de
State New
Headers show

Commit Message

Andreas Färber Dec. 17, 2010, 10:39 p.m. UTC
Don't reinvent C99 types like uint8_t by typedef'ing uint8 etc.
On BeOS and Haiku, system headers {be,os}/support/SupportDefs.h
do define [u]int{8,16,32,64}, but they define [u]int32 as long,
so assumptions that int32 and int can be used interchangeably
must be avoided. Inspired by mmlr's original port to Haiku.

Fix stray occurrences of softfloat-internal types outside fpu/.

v2:
* Rebased. Fix two new instances of int16 and uint16.

Cc: Michael Lotz <mmlr@mlotz.ch>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 fpu/softfloat-macros.h     |   44 +++---
 fpu/softfloat-specialize.h |    2 +-
 fpu/softfloat.c            |  368 ++++++++++++++++++++++----------------------
 fpu/softfloat.h            |   63 +++-----
 hw/apic.c                  |    2 +-
 hw/wdt_ib700.c             |    2 +-
 target-i386/cpu.h          |    8 +-
 7 files changed, 238 insertions(+), 251 deletions(-)
diff mbox

Patch

diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h
index 7838228..d635779 100644
--- a/fpu/softfloat-macros.h
+++ b/fpu/softfloat-macros.h
@@ -39,7 +39,7 @@  these four paragraphs for those parts of this code that are retained.
 | The result is stored in the location pointed to by `zPtr'.
 *----------------------------------------------------------------------------*/
 
-INLINE void shift32RightJamming( bits32 a, int16 count, bits32 *zPtr )
+INLINE void shift32RightJamming( bits32 a, int16_t count, bits32 *zPtr )
 {
     bits32 z;
 
@@ -65,7 +65,7 @@  INLINE void shift32RightJamming( bits32 a, int16 count, bits32 *zPtr )
 | The result is stored in the location pointed to by `zPtr'.
 *----------------------------------------------------------------------------*/
 
-INLINE void shift64RightJamming( bits64 a, int16 count, bits64 *zPtr )
+INLINE void shift64RightJamming( bits64 a, int16_t count, bits64 *zPtr )
 {
     bits64 z;
 
@@ -101,10 +101,10 @@  INLINE void shift64RightJamming( bits64 a, int16 count, bits64 *zPtr )
 
 INLINE void
  shift64ExtraRightJamming(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
+     bits64 a0, bits64 a1, int16_t count, bits64 *z0Ptr, bits64 *z1Ptr )
 {
     bits64 z0, z1;
-    int8 negCount = ( - count ) & 63;
+    int8_t negCount = ( - count ) & 63;
 
     if ( count == 0 ) {
         z1 = a1;
@@ -138,10 +138,10 @@  INLINE void
 
 INLINE void
  shift128Right(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
+     bits64 a0, bits64 a1, int16_t count, bits64 *z0Ptr, bits64 *z1Ptr )
 {
     bits64 z0, z1;
-    int8 negCount = ( - count ) & 63;
+    int8_t negCount = ( - count ) & 63;
 
     if ( count == 0 ) {
         z1 = a1;
@@ -173,10 +173,10 @@  INLINE void
 
 INLINE void
  shift128RightJamming(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
+     bits64 a0, bits64 a1, int16_t count, bits64 *z0Ptr, bits64 *z1Ptr )
 {
     bits64 z0, z1;
-    int8 negCount = ( - count ) & 63;
+    int8_t negCount = ( - count ) & 63;
 
     if ( count == 0 ) {
         z1 = a1;
@@ -227,14 +227,14 @@  INLINE void
      bits64 a0,
      bits64 a1,
      bits64 a2,
-     int16 count,
+     int16_t count,
      bits64 *z0Ptr,
      bits64 *z1Ptr,
      bits64 *z2Ptr
  )
 {
     bits64 z0, z1, z2;
-    int8 negCount = ( - count ) & 63;
+    int8_t negCount = ( - count ) & 63;
 
     if ( count == 0 ) {
         z2 = a2;
@@ -282,7 +282,7 @@  INLINE void
 
 INLINE void
  shortShift128Left(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
+     bits64 a0, bits64 a1, int16_t count, bits64 *z0Ptr, bits64 *z1Ptr )
 {
 
     *z1Ptr = a1<<count;
@@ -304,14 +304,14 @@  INLINE void
      bits64 a0,
      bits64 a1,
      bits64 a2,
-     int16 count,
+     int16_t count,
      bits64 *z0Ptr,
      bits64 *z1Ptr,
      bits64 *z2Ptr
  )
 {
     bits64 z0, z1, z2;
-    int8 negCount;
+    int8_t negCount;
 
     z2 = a2<<count;
     z1 = a1<<count;
@@ -368,7 +368,7 @@  INLINE void
  )
 {
     bits64 z0, z1, z2;
-    int8 carry0, carry1;
+    int8_t carry0, carry1;
 
     z2 = a2 + b2;
     carry1 = ( z2 < a2 );
@@ -424,7 +424,7 @@  INLINE void
  )
 {
     bits64 z0, z1, z2;
-    int8 borrow0, borrow1;
+    int8_t borrow0, borrow1;
 
     z2 = a2 - b2;
     borrow1 = ( a2 < b2 );
@@ -575,7 +575,7 @@  static bits64 estimateDiv128To64( bits64 a0, bits64 a1, bits64 b )
 | value.
 *----------------------------------------------------------------------------*/
 
-static bits32 estimateSqrt32( int16 aExp, bits32 a )
+static bits32 estimateSqrt32( int16_t aExp, bits32 a )
 {
     static const bits16 sqrtOddAdjustments[] = {
         0x0004, 0x0022, 0x005D, 0x00B1, 0x011D, 0x019F, 0x0236, 0x02E0,
@@ -585,7 +585,7 @@  static bits32 estimateSqrt32( int16 aExp, bits32 a )
         0x0A2D, 0x08AF, 0x075A, 0x0629, 0x051A, 0x0429, 0x0356, 0x029E,
         0x0200, 0x0179, 0x0109, 0x00AF, 0x0068, 0x0034, 0x0012, 0x0002
     };
-    int8 index;
+    int8_t index;
     bits32 z;
 
     index = ( a>>27 ) & 15;
@@ -609,9 +609,9 @@  static bits32 estimateSqrt32( int16 aExp, bits32 a )
 | `a'.  If `a' is zero, 32 is returned.
 *----------------------------------------------------------------------------*/
 
-static int8 countLeadingZeros32( bits32 a )
+static int8_t countLeadingZeros32( bits32 a )
 {
-    static const int8 countLeadingZerosHigh[] = {
+    static const int8_t countLeadingZerosHigh[] = {
         8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
         3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
         2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -629,7 +629,7 @@  static int8 countLeadingZeros32( bits32 a )
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     };
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = 0;
     if ( a < 0x10000 ) {
@@ -650,9 +650,9 @@  static int8 countLeadingZeros32( bits32 a )
 | `a'.  If `a' is zero, 64 is returned.
 *----------------------------------------------------------------------------*/
 
-static int8 countLeadingZeros64( bits64 a )
+static int8_t countLeadingZeros64( bits64 a )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = 0;
     if ( a < ( (bits64) 1 )<<32 ) {
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index 0746878..0c36388 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -43,7 +43,7 @@  these four paragraphs for those parts of this code that are retained.
 | should be simply `float_exception_flags |= flags;'.
 *----------------------------------------------------------------------------*/
 
-void float_raise( int8 flags STATUS_PARAM )
+void float_raise( int8_t flags STATUS_PARAM )
 {
     STATUS(float_exception_flags) |= flags;
 }
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 6f5b05d..20f1bc8 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -79,12 +79,12 @@  void set_floatx80_rounding_precision(int val STATUS_PARAM)
 | positive or negative integer is returned.
 *----------------------------------------------------------------------------*/
 
-static int32 roundAndPackInt32( flag zSign, bits64 absZ STATUS_PARAM)
+static int32_t roundAndPackInt32( flag zSign, bits64 absZ STATUS_PARAM)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven;
-    int8 roundIncrement, roundBits;
-    int32 z;
+    int8_t roundIncrement, roundBits;
+    int32_t z;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -129,11 +129,11 @@  static int32 roundAndPackInt32( flag zSign, bits64 absZ STATUS_PARAM)
 | returned.
 *----------------------------------------------------------------------------*/
 
-static int64 roundAndPackInt64( flag zSign, bits64 absZ0, bits64 absZ1 STATUS_PARAM)
+static int64_t roundAndPackInt64( flag zSign, bits64 absZ0, bits64 absZ1 STATUS_PARAM)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven, increment;
-    int64 z;
+    int64_t z;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -185,7 +185,7 @@  INLINE bits32 extractFloat32Frac( float32 a )
 | Returns the exponent bits of the single-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int16 extractFloat32Exp( float32 a )
+INLINE int16_t extractFloat32Exp( float32 a )
 {
 
     return ( float32_val(a)>>23 ) & 0xFF;
@@ -211,9 +211,9 @@  INLINE flag extractFloat32Sign( float32 a )
 *----------------------------------------------------------------------------*/
 
 static void
- normalizeFloat32Subnormal( bits32 aSig, int16 *zExpPtr, bits32 *zSigPtr )
+ normalizeFloat32Subnormal( bits32 aSig, int16_t *zExpPtr, bits32 *zSigPtr )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros32( aSig ) - 8;
     *zSigPtr = aSig<<shiftCount;
@@ -232,7 +232,7 @@  static void
 | significand.
 *----------------------------------------------------------------------------*/
 
-INLINE float32 packFloat32( flag zSign, int16 zExp, bits32 zSig )
+INLINE float32 packFloat32( flag zSign, int16_t zExp, bits32 zSig )
 {
 
     return make_float32(
@@ -262,11 +262,11 @@  INLINE float32 packFloat32( flag zSign, int16 zExp, bits32 zSig )
 | Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig STATUS_PARAM)
+static float32 roundAndPackFloat32( flag zSign, int16_t zExp, bits32 zSig STATUS_PARAM)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven;
-    int8 roundIncrement, roundBits;
+    int8_t roundIncrement, roundBits;
     flag isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -325,9 +325,9 @@  static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig STATUS_P
 *----------------------------------------------------------------------------*/
 
 static float32
- normalizeRoundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig STATUS_PARAM)
+ normalizeRoundAndPackFloat32( flag zSign, int16_t zExp, bits32 zSig STATUS_PARAM)
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros32( zSig ) - 1;
     return roundAndPackFloat32( zSign, zExp - shiftCount, zSig<<shiftCount STATUS_VAR);
@@ -349,7 +349,7 @@  INLINE bits64 extractFloat64Frac( float64 a )
 | Returns the exponent bits of the double-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int16 extractFloat64Exp( float64 a )
+INLINE int16_t extractFloat64Exp( float64 a )
 {
 
     return ( float64_val(a)>>52 ) & 0x7FF;
@@ -375,9 +375,9 @@  INLINE flag extractFloat64Sign( float64 a )
 *----------------------------------------------------------------------------*/
 
 static void
- normalizeFloat64Subnormal( bits64 aSig, int16 *zExpPtr, bits64 *zSigPtr )
+ normalizeFloat64Subnormal( bits64 aSig, int16_t *zExpPtr, bits64 *zSigPtr )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros64( aSig ) - 11;
     *zSigPtr = aSig<<shiftCount;
@@ -396,7 +396,7 @@  static void
 | significand.
 *----------------------------------------------------------------------------*/
 
-INLINE float64 packFloat64( flag zSign, int16 zExp, bits64 zSig )
+INLINE float64 packFloat64( flag zSign, int16_t zExp, bits64 zSig )
 {
 
     return make_float64(
@@ -426,11 +426,11 @@  INLINE float64 packFloat64( flag zSign, int16 zExp, bits64 zSig )
 | Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig STATUS_PARAM)
+static float64 roundAndPackFloat64( flag zSign, int16_t zExp, bits64 zSig STATUS_PARAM)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven;
-    int16 roundIncrement, roundBits;
+    int16_t roundIncrement, roundBits;
     flag isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -489,9 +489,9 @@  static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig STATUS_P
 *----------------------------------------------------------------------------*/
 
 static float64
- normalizeRoundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig STATUS_PARAM)
+ normalizeRoundAndPackFloat64( flag zSign, int16_t zExp, bits64 zSig STATUS_PARAM)
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros64( zSig ) - 1;
     return roundAndPackFloat64( zSign, zExp - shiftCount, zSig<<shiftCount STATUS_VAR);
@@ -517,7 +517,7 @@  INLINE bits64 extractFloatx80Frac( floatx80 a )
 | value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int32 extractFloatx80Exp( floatx80 a )
+INLINE int32_t extractFloatx80Exp( floatx80 a )
 {
 
     return a.high & 0x7FFF;
@@ -544,9 +544,9 @@  INLINE flag extractFloatx80Sign( floatx80 a )
 *----------------------------------------------------------------------------*/
 
 static void
- normalizeFloatx80Subnormal( bits64 aSig, int32 *zExpPtr, bits64 *zSigPtr )
+ normalizeFloatx80Subnormal( bits64 aSig, int32_t *zExpPtr, bits64 *zSigPtr )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros64( aSig );
     *zSigPtr = aSig<<shiftCount;
@@ -559,7 +559,7 @@  static void
 | extended double-precision floating-point value, returning the result.
 *----------------------------------------------------------------------------*/
 
-INLINE floatx80 packFloatx80( flag zSign, int32 zExp, bits64 zSig )
+INLINE floatx80 packFloatx80( flag zSign, int32_t zExp, bits64 zSig )
 {
     floatx80 z;
 
@@ -595,12 +595,12 @@  INLINE floatx80 packFloatx80( flag zSign, int32 zExp, bits64 zSig )
 
 static floatx80
  roundAndPackFloatx80(
-     int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
+     int8_t roundingPrecision, flag zSign, int32_t zExp, bits64 zSig0, bits64 zSig1
  STATUS_PARAM)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
-    int64 roundIncrement, roundMask, roundBits;
+    int64_t roundIncrement, roundMask, roundBits;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -764,10 +764,10 @@  static floatx80
 
 static floatx80
  normalizeRoundAndPackFloatx80(
-     int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
+     int8_t roundingPrecision, flag zSign, int32_t zExp, bits64 zSig0, bits64 zSig1
  STATUS_PARAM)
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     if ( zSig0 == 0 ) {
         zSig0 = zSig1;
@@ -815,7 +815,7 @@  INLINE bits64 extractFloat128Frac0( float128 a )
 | `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int32 extractFloat128Exp( float128 a )
+INLINE int32_t extractFloat128Exp( float128 a )
 {
 
     return ( a.high>>48 ) & 0x7FFF;
@@ -847,12 +847,12 @@  static void
  normalizeFloat128Subnormal(
      bits64 aSig0,
      bits64 aSig1,
-     int32 *zExpPtr,
+     int32_t *zExpPtr,
      bits64 *zSig0Ptr,
      bits64 *zSig1Ptr
  )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     if ( aSig0 == 0 ) {
         shiftCount = countLeadingZeros64( aSig1 ) - 15;
@@ -888,7 +888,7 @@  static void
 *----------------------------------------------------------------------------*/
 
 INLINE float128
- packFloat128( flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1 )
+ packFloat128( flag zSign, int32_t zExp, bits64 zSig0, bits64 zSig1 )
 {
     float128 z;
 
@@ -921,9 +921,9 @@  INLINE float128
 
 static float128
  roundAndPackFloat128(
-     flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1, bits64 zSig2 STATUS_PARAM)
+     flag zSign, int32_t zExp, bits64 zSig0, bits64 zSig1, bits64 zSig2 STATUS_PARAM)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -1022,9 +1022,9 @@  static float128
 
 static float128
  normalizeRoundAndPackFloat128(
-     flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1 STATUS_PARAM)
+     flag zSign, int32_t zExp, bits64 zSig0, bits64 zSig1 STATUS_PARAM)
 {
-    int8 shiftCount;
+    int8_t shiftCount;
     bits64 zSig2;
 
     if ( zSig0 == 0 ) {
@@ -1054,7 +1054,7 @@  static float128
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float32 int32_to_float32( int32 a STATUS_PARAM )
+float32 int32_to_float32( int32_t a STATUS_PARAM )
 {
     flag zSign;
 
@@ -1071,11 +1071,11 @@  float32 int32_to_float32( int32 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float64 int32_to_float64( int32 a STATUS_PARAM )
+float64 int32_to_float64( int32_t a STATUS_PARAM )
 {
     flag zSign;
-    uint32 absA;
-    int8 shiftCount;
+    uint32_t absA;
+    int8_t shiftCount;
     bits64 zSig;
 
     if ( a == 0 ) return float64_zero;
@@ -1096,11 +1096,11 @@  float64 int32_to_float64( int32 a STATUS_PARAM )
 | Arithmetic.
 *----------------------------------------------------------------------------*/
 
-floatx80 int32_to_floatx80( int32 a STATUS_PARAM )
+floatx80 int32_to_floatx80( int32_t a STATUS_PARAM )
 {
     flag zSign;
-    uint32 absA;
-    int8 shiftCount;
+    uint32_t absA;
+    int8_t shiftCount;
     bits64 zSig;
 
     if ( a == 0 ) return packFloatx80( 0, 0, 0 );
@@ -1122,11 +1122,11 @@  floatx80 int32_to_floatx80( int32 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float128 int32_to_float128( int32 a STATUS_PARAM )
+float128 int32_to_float128( int32_t a STATUS_PARAM )
 {
     flag zSign;
-    uint32 absA;
-    int8 shiftCount;
+    uint32_t absA;
+    int8_t shiftCount;
     bits64 zSig0;
 
     if ( a == 0 ) return packFloat128( 0, 0, 0, 0 );
@@ -1146,11 +1146,11 @@  float128 int32_to_float128( int32 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float32 int64_to_float32( int64 a STATUS_PARAM )
+float32 int64_to_float32( int64_t a STATUS_PARAM )
 {
     flag zSign;
-    uint64 absA;
-    int8 shiftCount;
+    uint64_t absA;
+    int8_t shiftCount;
 
     if ( a == 0 ) return float32_zero;
     zSign = ( a < 0 );
@@ -1172,9 +1172,9 @@  float32 int64_to_float32( int64 a STATUS_PARAM )
 
 }
 
-float32 uint64_to_float32( uint64 a STATUS_PARAM )
+float32 uint64_to_float32( uint64_t a STATUS_PARAM )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     if ( a == 0 ) return float32_zero;
     shiftCount = countLeadingZeros64( a ) - 40;
@@ -1199,7 +1199,7 @@  float32 uint64_to_float32( uint64 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float64 int64_to_float64( int64 a STATUS_PARAM )
+float64 int64_to_float64( int64_t a STATUS_PARAM )
 {
     flag zSign;
 
@@ -1212,7 +1212,7 @@  float64 int64_to_float64( int64 a STATUS_PARAM )
 
 }
 
-float64 uint64_to_float64( uint64 a STATUS_PARAM )
+float64 uint64_to_float64( uint64_t a STATUS_PARAM )
 {
     if ( a == 0 ) return float64_zero;
     return normalizeRoundAndPackFloat64( 0, 0x43C, a STATUS_VAR );
@@ -1228,11 +1228,11 @@  float64 uint64_to_float64( uint64 a STATUS_PARAM )
 | Arithmetic.
 *----------------------------------------------------------------------------*/
 
-floatx80 int64_to_floatx80( int64 a STATUS_PARAM )
+floatx80 int64_to_floatx80( int64_t a STATUS_PARAM )
 {
     flag zSign;
-    uint64 absA;
-    int8 shiftCount;
+    uint64_t absA;
+    int8_t shiftCount;
 
     if ( a == 0 ) return packFloatx80( 0, 0, 0 );
     zSign = ( a < 0 );
@@ -1252,12 +1252,12 @@  floatx80 int64_to_floatx80( int64 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float128 int64_to_float128( int64 a STATUS_PARAM )
+float128 int64_to_float128( int64_t a STATUS_PARAM )
 {
     flag zSign;
-    uint64 absA;
-    int8 shiftCount;
-    int32 zExp;
+    uint64_t absA;
+    int8_t shiftCount;
+    int32_t zExp;
     bits64 zSig0, zSig1;
 
     if ( a == 0 ) return packFloat128( 0, 0, 0, 0 );
@@ -1291,10 +1291,10 @@  float128 int64_to_float128( int64 a STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 float32_to_int32( float32 a STATUS_PARAM )
+int32_t float32_to_int32( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits32 aSig;
     bits64 aSig64;
 
@@ -1321,12 +1321,12 @@  int32 float32_to_int32( float32 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int32 float32_to_int32_round_to_zero( float32 a STATUS_PARAM )
+int32_t float32_to_int32_round_to_zero( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits32 aSig;
-    int32 z;
+    int32_t z;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -1363,12 +1363,12 @@  int32 float32_to_int32_round_to_zero( float32 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int16 float32_to_int16_round_to_zero( float32 a STATUS_PARAM )
+int16_t float32_to_int16_round_to_zero( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits32 aSig;
-    int32 z;
+    int32_t z;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -1412,10 +1412,10 @@  int16 float32_to_int16_round_to_zero( float32 a STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 float32_to_int64( float32 a STATUS_PARAM )
+int64_t float32_to_int64( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits32 aSig;
     bits64 aSig64, aSigExtra;
 
@@ -1448,13 +1448,13 @@  int64 float32_to_int64( float32 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int64 float32_to_int64_round_to_zero( float32 a STATUS_PARAM )
+int64_t float32_to_int64_round_to_zero( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits32 aSig;
     bits64 aSig64;
-    int64 z;
+    int64_t z;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -1494,7 +1494,7 @@  int64 float32_to_int64_round_to_zero( float32 a STATUS_PARAM )
 float64 float32_to_float64( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig;
 
     aSig = extractFloat32Frac( a );
@@ -1525,7 +1525,7 @@  float64 float32_to_float64( float32 a STATUS_PARAM )
 floatx80 float32_to_floatx80( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig;
 
     aSig = extractFloat32Frac( a );
@@ -1558,7 +1558,7 @@  floatx80 float32_to_floatx80( float32 a STATUS_PARAM )
 float128 float32_to_float128( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig;
 
     aSig = extractFloat32Frac( a );
@@ -1589,9 +1589,9 @@  float128 float32_to_float128( float32 a STATUS_PARAM )
 float32 float32_round_to_int( float32 a STATUS_PARAM)
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int8_t roundingMode;
     bits32 z;
 
     aExp = extractFloat32Exp( a );
@@ -1648,9 +1648,9 @@  float32 float32_round_to_int( float32 a STATUS_PARAM)
 
 static float32 addFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 {
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits32 aSig, bSig, zSig;
-    int16 expDiff;
+    int16_t expDiff;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -1722,9 +1722,9 @@  static float32 addFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 
 static float32 subFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 {
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits32 aSig, bSig, zSig;
-    int16 expDiff;
+    int16_t expDiff;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -1838,7 +1838,7 @@  float32 float32_sub( float32 a, float32 b STATUS_PARAM )
 float32 float32_mul( float32 a, float32 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits32 aSig, bSig;
     bits64 zSig64;
     bits32 zSig;
@@ -1898,7 +1898,7 @@  float32 float32_mul( float32 a, float32 b STATUS_PARAM )
 float32 float32_div( float32 a, float32 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits32 aSig, bSig, zSig;
 
     aSig = extractFloat32Frac( a );
@@ -1960,7 +1960,7 @@  float32 float32_div( float32 a, float32 b STATUS_PARAM )
 float32 float32_rem( float32 a, float32 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp, bExp, expDiff;
+    int16_t aExp, bExp, expDiff;
     bits32 aSig, bSig;
     bits32 q;
     bits64 aSig64, bSig64, q64;
@@ -2059,7 +2059,7 @@  float32 float32_rem( float32 a, float32 b STATUS_PARAM )
 float32 float32_sqrt( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, zExp;
+    int16_t aExp, zExp;
     bits32 aSig, zSig;
     bits64 rem, term;
 
@@ -2144,7 +2144,7 @@  static const float64 float32_exp2_coefficients[15] =
 float32 float32_exp2( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig;
     float64 r, x, xn;
     int i;
@@ -2191,7 +2191,7 @@  float32 float32_exp2( float32 a STATUS_PARAM )
 float32 float32_log2( float32 a STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig, zSig, i;
 
     aSig = extractFloat32Frac( a );
@@ -2396,10 +2396,10 @@  int float32_lt_quiet( float32 a, float32 b STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 float64_to_int32( float64 a STATUS_PARAM )
+int32_t float64_to_int32( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits64 aSig;
 
     aSig = extractFloat64Frac( a );
@@ -2423,12 +2423,12 @@  int32 float64_to_int32( float64 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int32 float64_to_int32_round_to_zero( float64 a STATUS_PARAM )
+int32_t float64_to_int32_round_to_zero( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits64 aSig, savedASig;
-    int32 z;
+    int32_t z;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -2469,12 +2469,12 @@  int32 float64_to_int32_round_to_zero( float64 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int16 float64_to_int16_round_to_zero( float64 a STATUS_PARAM )
+int16_t float64_to_int16_round_to_zero( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits64 aSig, savedASig;
-    int32 z;
+    int32_t z;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -2520,10 +2520,10 @@  int16 float64_to_int16_round_to_zero( float64 a STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 float64_to_int64( float64 a STATUS_PARAM )
+int64_t float64_to_int64( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits64 aSig, aSigExtra;
 
     aSig = extractFloat64Frac( a );
@@ -2562,12 +2562,12 @@  int64 float64_to_int64( float64 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int64 float64_to_int64_round_to_zero( float64 a STATUS_PARAM )
+int64_t float64_to_int64_round_to_zero( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int16_t aExp, shiftCount;
     bits64 aSig;
-    int64 z;
+    int64_t z;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -2614,7 +2614,7 @@  int64 float64_to_int64_round_to_zero( float64 a STATUS_PARAM )
 float32 float64_to_float32( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 aSig;
     bits32 zSig;
 
@@ -2646,7 +2646,7 @@  float32 float64_to_float32( float64 a STATUS_PARAM )
 | than the desired result exponent whenever `zSig' is a complete, normalized
 | significand.
 *----------------------------------------------------------------------------*/
-static bits16 packFloat16(flag zSign, int16 zExp, bits16 zSig)
+static bits16 packFloat16(flag zSign, int16_t zExp, bits16 zSig)
 {
     return (((bits32)zSign) << 15) + (((bits32)zExp) << 10) + zSig;
 }
@@ -2657,7 +2657,7 @@  static bits16 packFloat16(flag zSign, int16 zExp, bits16 zSig)
 float32 float16_to_float32( bits16 a, flag ieee STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig;
 
     aSign = a >> 15;
@@ -2673,7 +2673,7 @@  float32 float16_to_float32( bits16 a, flag ieee STATUS_PARAM )
         return packFloat32(aSign, 0xff, aSig << 13);
     }
     if (aExp == 0) {
-        int8 shiftCount;
+        int8_t shiftCount;
 
         if (aSig == 0) {
             return packFloat32(aSign, 0, 0);
@@ -2689,11 +2689,11 @@  float32 float16_to_float32( bits16 a, flag ieee STATUS_PARAM )
 bits16 float32_to_float16( float32 a, flag ieee STATUS_PARAM)
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig;
     bits32 mask;
     bits32 increment;
-    int8 roundingMode;
+    int8_t roundingMode;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -2785,7 +2785,7 @@  bits16 float32_to_float16( float32 a, flag ieee STATUS_PARAM)
 floatx80 float64_to_floatx80( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 aSig;
 
     aSig = extractFloat64Frac( a );
@@ -2819,7 +2819,7 @@  floatx80 float64_to_floatx80( float64 a STATUS_PARAM )
 float128 float64_to_float128( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 aSig, zSig0, zSig1;
 
     aSig = extractFloat64Frac( a );
@@ -2851,9 +2851,9 @@  float128 float64_to_float128( float64 a STATUS_PARAM )
 float64 float64_round_to_int( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int8_t roundingMode;
     bits64 z;
 
     aExp = extractFloat64Exp( a );
@@ -2923,9 +2923,9 @@  float64 float64_trunc_to_int( float64 a STATUS_PARAM)
 
 static float64 addFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 {
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig;
-    int16 expDiff;
+    int16_t expDiff;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -2997,9 +2997,9 @@  static float64 addFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 
 static float64 subFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 {
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig;
-    int16 expDiff;
+    int16_t expDiff;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -3113,7 +3113,7 @@  float64 float64_sub( float64 a, float64 b STATUS_PARAM )
 float64 float64_mul( float64 a, float64 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig0, zSig1;
 
     aSig = extractFloat64Frac( a );
@@ -3171,7 +3171,7 @@  float64 float64_mul( float64 a, float64 b STATUS_PARAM )
 float64 float64_div( float64 a, float64 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int16_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig;
     bits64 rem0, rem1;
     bits64 term0, term1;
@@ -3241,7 +3241,7 @@  float64 float64_div( float64 a, float64 b STATUS_PARAM )
 float64 float64_rem( float64 a, float64 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp, bExp, expDiff;
+    int16_t aExp, bExp, expDiff;
     bits64 aSig, bSig;
     bits64 q, alternateASig;
     sbits64 sigMean;
@@ -3325,7 +3325,7 @@  float64 float64_rem( float64 a, float64 b STATUS_PARAM )
 float64 float64_sqrt( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, zExp;
+    int16_t aExp, zExp;
     bits64 aSig, zSig, doubleZSig;
     bits64 rem0, rem1, term0, term1;
 
@@ -3375,7 +3375,7 @@  float64 float64_sqrt( float64 a STATUS_PARAM )
 float64 float64_log2( float64 a STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 aSig, aSig0, aSig1, zSig, i;
 
     aSig = extractFloat64Frac( a );
@@ -3583,10 +3583,10 @@  int float64_lt_quiet( float64 a, float64 b STATUS_PARAM )
 | overflows, the largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 floatx80_to_int32( floatx80 a STATUS_PARAM )
+int32_t floatx80_to_int32( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig;
 
     aSig = extractFloatx80Frac( a );
@@ -3610,12 +3610,12 @@  int32 floatx80_to_int32( floatx80 a STATUS_PARAM )
 | sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM )
+int32_t floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig, savedASig;
-    int32 z;
+    int32_t z;
 
     aSig = extractFloatx80Frac( a );
     aExp = extractFloatx80Exp( a );
@@ -3655,10 +3655,10 @@  int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM )
 | overflows, the largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 floatx80_to_int64( floatx80 a STATUS_PARAM )
+int64_t floatx80_to_int64( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig, aSigExtra;
 
     aSig = extractFloatx80Frac( a );
@@ -3695,12 +3695,12 @@  int64 floatx80_to_int64( floatx80 a STATUS_PARAM )
 | sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM )
+int64_t floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig;
-    int64 z;
+    int64_t z;
 
     aSig = extractFloatx80Frac( a );
     aExp = extractFloatx80Exp( a );
@@ -3739,7 +3739,7 @@  int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM )
 float32 floatx80_to_float32( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 aSig;
 
     aSig = extractFloatx80Frac( a );
@@ -3767,7 +3767,7 @@  float32 floatx80_to_float32( floatx80 a STATUS_PARAM )
 float64 floatx80_to_float64( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 aSig, zSig;
 
     aSig = extractFloatx80Frac( a );
@@ -3797,7 +3797,7 @@  float64 floatx80_to_float64( floatx80 a STATUS_PARAM )
 float128 floatx80_to_float128( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 aSig, zSig0, zSig1;
 
     aSig = extractFloatx80Frac( a );
@@ -3823,9 +3823,9 @@  float128 floatx80_to_float128( floatx80 a STATUS_PARAM )
 floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int8_t roundingMode;
     floatx80 z;
 
     aExp = extractFloatx80Exp( a );
@@ -3896,9 +3896,9 @@  floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM )
 
 static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM)
 {
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig0, zSig1;
-    int32 expDiff;
+    int32_t expDiff;
 
     aSig = extractFloatx80Frac( a );
     aExp = extractFloatx80Exp( a );
@@ -3962,9 +3962,9 @@  static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM
 
 static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM )
 {
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig0, zSig1;
-    int32 expDiff;
+    int32_t expDiff;
     floatx80 z;
 
     aSig = extractFloatx80Frac( a );
@@ -4071,7 +4071,7 @@  floatx80 floatx80_sub( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig0, zSig1;
     floatx80 z;
 
@@ -4130,7 +4130,7 @@  floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig, bSig, zSig0, zSig1;
     bits64 rem0, rem1, rem2, term0, term1, term2;
     floatx80 z;
@@ -4210,7 +4210,7 @@  floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int32 aExp, bExp, expDiff;
+    int32_t aExp, bExp, expDiff;
     bits64 aSig0, aSig1, bSig;
     bits64 q, term0, term1, alternateASig0, alternateASig1;
     floatx80 z;
@@ -4306,7 +4306,7 @@  floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_sqrt( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, zExp;
+    int32_t aExp, zExp;
     bits64 aSig0, aSig1, zSig0, zSig1, doubleZSig0;
     bits64 rem0, rem1, rem2, rem3, term0, term1, term2, term3;
     floatx80 z;
@@ -4576,10 +4576,10 @@  int floatx80_lt_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 float128_to_int32( float128 a STATUS_PARAM )
+int32_t float128_to_int32( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -4605,12 +4605,12 @@  int32 float128_to_int32( float128 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM )
+int32_t float128_to_int32_round_to_zero( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig0, aSig1, savedASig;
-    int32 z;
+    int32_t z;
 
     aSig1 = extractFloat128Frac1( a );
     aSig0 = extractFloat128Frac0( a );
@@ -4653,10 +4653,10 @@  int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 float128_to_int64( float128 a STATUS_PARAM )
+int64_t float128_to_int64( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -4696,12 +4696,12 @@  int64 float128_to_int64( float128 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM )
+int64_t float128_to_int64_round_to_zero( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int32_t aExp, shiftCount;
     bits64 aSig0, aSig1;
-    int64 z;
+    int64_t z;
 
     aSig1 = extractFloat128Frac1( a );
     aSig0 = extractFloat128Frac0( a );
@@ -4757,7 +4757,7 @@  int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM )
 float32 float128_to_float32( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 aSig0, aSig1;
     bits32 zSig;
 
@@ -4792,7 +4792,7 @@  float32 float128_to_float32( float128 a STATUS_PARAM )
 float64 float128_to_float64( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -4827,7 +4827,7 @@  float64 float128_to_float64( float128 a STATUS_PARAM )
 floatx80 float128_to_floatx80( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -4864,9 +4864,9 @@  floatx80 float128_to_floatx80( float128 a STATUS_PARAM )
 float128 float128_round_to_int( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int8_t roundingMode;
     float128 z;
 
     aExp = extractFloat128Exp( a );
@@ -4967,9 +4967,9 @@  float128 float128_round_to_int( float128 a STATUS_PARAM )
 
 static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM)
 {
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;
-    int32 expDiff;
+    int32_t expDiff;
 
     aSig1 = extractFloat128Frac1( a );
     aSig0 = extractFloat128Frac0( a );
@@ -5048,9 +5048,9 @@  static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM
 
 static float128 subFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM)
 {
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig0, aSig1, bSig0, bSig1, zSig0, zSig1;
-    int32 expDiff;
+    int32_t expDiff;
     float128 z;
 
     aSig1 = extractFloat128Frac1( a );
@@ -5173,7 +5173,7 @@  float128 float128_sub( float128 a, float128 b STATUS_PARAM )
 float128 float128_mul( float128 a, float128 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2, zSig3;
     float128 z;
 
@@ -5237,7 +5237,7 @@  float128 float128_mul( float128 a, float128 b STATUS_PARAM )
 float128 float128_div( float128 a, float128 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int32_t aExp, bExp, zExp;
     bits64 aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;
     bits64 rem0, rem1, rem2, rem3, term0, term1, term2, term3;
     float128 z;
@@ -5321,7 +5321,7 @@  float128 float128_div( float128 a, float128 b STATUS_PARAM )
 float128 float128_rem( float128 a, float128 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int32 aExp, bExp, expDiff;
+    int32_t aExp, bExp, expDiff;
     bits64 aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2;
     bits64 allZero, alternateASig0, alternateASig1, sigMean1;
     sbits64 sigMean0;
@@ -5430,7 +5430,7 @@  float128 float128_rem( float128 a, float128 b STATUS_PARAM )
 float128 float128_sqrt( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, zExp;
+    int32_t aExp, zExp;
     bits64 aSig0, aSig1, zSig0, zSig1, zSig2, doubleZSig0;
     bits64 rem0, rem1, rem2, rem3, term0, term1, term2, term3;
     float128 z;
@@ -5686,17 +5686,17 @@  int float128_lt_quiet( float128 a, float128 b STATUS_PARAM )
 #endif
 
 /* misc functions */
-float32 uint32_to_float32( unsigned int a STATUS_PARAM )
+float32 uint32_to_float32( uint32_t a STATUS_PARAM )
 {
     return int64_to_float32(a STATUS_VAR);
 }
 
-float64 uint32_to_float64( unsigned int a STATUS_PARAM )
+float64 uint32_to_float64( uint32_t a STATUS_PARAM )
 {
     return int64_to_float64(a STATUS_VAR);
 }
 
-unsigned int float32_to_uint32( float32 a STATUS_PARAM )
+uint32_t float32_to_uint32( float32 a STATUS_PARAM )
 {
     int64_t v;
     unsigned int res;
@@ -5714,7 +5714,7 @@  unsigned int float32_to_uint32( float32 a STATUS_PARAM )
     return res;
 }
 
-unsigned int float32_to_uint32_round_to_zero( float32 a STATUS_PARAM )
+uint32_t float32_to_uint32_round_to_zero( float32 a STATUS_PARAM )
 {
     int64_t v;
     unsigned int res;
@@ -5732,7 +5732,7 @@  unsigned int float32_to_uint32_round_to_zero( float32 a STATUS_PARAM )
     return res;
 }
 
-unsigned int float32_to_uint16_round_to_zero( float32 a STATUS_PARAM )
+uint16_t float32_to_uint16_round_to_zero( float32 a STATUS_PARAM )
 {
     int64_t v;
     unsigned int res;
@@ -5750,7 +5750,7 @@  unsigned int float32_to_uint16_round_to_zero( float32 a STATUS_PARAM )
     return res;
 }
 
-unsigned int float64_to_uint32( float64 a STATUS_PARAM )
+uint32_t float64_to_uint32( float64 a STATUS_PARAM )
 {
     int64_t v;
     unsigned int res;
@@ -5768,7 +5768,7 @@  unsigned int float64_to_uint32( float64 a STATUS_PARAM )
     return res;
 }
 
-unsigned int float64_to_uint32_round_to_zero( float64 a STATUS_PARAM )
+uint32_t float64_to_uint32_round_to_zero( float64 a STATUS_PARAM )
 {
     int64_t v;
     unsigned int res;
@@ -5786,7 +5786,7 @@  unsigned int float64_to_uint32_round_to_zero( float64 a STATUS_PARAM )
     return res;
 }
 
-unsigned int float64_to_uint16_round_to_zero( float64 a STATUS_PARAM )
+uint16_t float64_to_uint16_round_to_zero( float64 a STATUS_PARAM )
 {
     int64_t v;
     unsigned int res;
@@ -5926,7 +5926,7 @@  int float128_compare_quiet( float128 a, float128 b STATUS_PARAM )
 float32 float32_scalbn( float32 a, int n STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits32 aSig;
 
     aSig = extractFloat32Frac( a );
@@ -5949,7 +5949,7 @@  float32 float32_scalbn( float32 a, int n STATUS_PARAM )
 float64 float64_scalbn( float64 a, int n STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 aSig;
 
     aSig = extractFloat64Frac( a );
@@ -5973,7 +5973,7 @@  float64 float64_scalbn( float64 a, int n STATUS_PARAM )
 floatx80 floatx80_scalbn( floatx80 a, int n STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int16_t aExp;
     bits64 aSig;
 
     aSig = extractFloatx80Frac( a );
@@ -5996,7 +5996,7 @@  floatx80 floatx80_scalbn( floatx80 a, int n STATUS_PARAM )
 float128 float128_scalbn( float128 a, int n STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int32_t aExp;
     bits64 aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 1c1004d..e97b11f 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -41,23 +41,10 @@  these four paragraphs for those parts of this code that are retained.
 
 /*----------------------------------------------------------------------------
 | Each of the following `typedef's defines the most convenient type that holds
-| integers of at least as many bits as specified.  For example, `uint8' should
-| be the most convenient type that can hold unsigned integers of as many as
-| 8 bits.  The `flag' type must be able to hold either a 0 or 1.  For most
-| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
-| to the same as `int'.
+| integers of at least as many bits as specified.
+| The `flag' type must be able to hold either a 0 or 1.
 *----------------------------------------------------------------------------*/
 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;
-typedef signed int int32;
-typedef uint64_t uint64;
-typedef int64_t int64;
 
 /*----------------------------------------------------------------------------
 | Each of the following `typedef's defines a type that holds integers
@@ -216,20 +203,20 @@  void set_floatx80_rounding_precision(int val STATUS_PARAM);
 | Routine to raise any or all of the software IEC/IEEE floating-point
 | exception flags.
 *----------------------------------------------------------------------------*/
-void float_raise( int8 flags STATUS_PARAM);
+void float_raise( int8_t flags STATUS_PARAM);
 
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE integer-to-floating-point conversion routines.
 *----------------------------------------------------------------------------*/
-float32 int32_to_float32( int STATUS_PARAM );
-float64 int32_to_float64( int STATUS_PARAM );
-float32 uint32_to_float32( unsigned int STATUS_PARAM );
-float64 uint32_to_float64( unsigned int STATUS_PARAM );
+float32 int32_to_float32( int32_t STATUS_PARAM );
+float64 int32_to_float64( int32_t STATUS_PARAM );
+float32 uint32_to_float32( uint32_t STATUS_PARAM );
+float64 uint32_to_float64( uint32_t STATUS_PARAM );
 #ifdef FLOATX80
-floatx80 int32_to_floatx80( int STATUS_PARAM );
+floatx80 int32_to_floatx80( int32_t STATUS_PARAM );
 #endif
 #ifdef FLOAT128
-float128 int32_to_float128( int STATUS_PARAM );
+float128 int32_to_float128( int32_t STATUS_PARAM );
 #endif
 float32 int64_to_float32( int64_t STATUS_PARAM );
 float32 uint64_to_float32( uint64_t STATUS_PARAM );
@@ -251,12 +238,12 @@  float32 float16_to_float32( bits16, flag STATUS_PARAM );
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE single-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int float32_to_int16_round_to_zero( float32 STATUS_PARAM );
-unsigned int float32_to_uint16_round_to_zero( float32 STATUS_PARAM );
-int float32_to_int32( float32 STATUS_PARAM );
-int float32_to_int32_round_to_zero( float32 STATUS_PARAM );
-unsigned int float32_to_uint32( float32 STATUS_PARAM );
-unsigned int float32_to_uint32_round_to_zero( float32 STATUS_PARAM );
+int16_t float32_to_int16_round_to_zero( float32 STATUS_PARAM );
+uint16_t float32_to_uint16_round_to_zero( float32 STATUS_PARAM );
+int32_t float32_to_int32( float32 STATUS_PARAM );
+int32_t float32_to_int32_round_to_zero( float32 STATUS_PARAM );
+uint32_t float32_to_uint32( float32 STATUS_PARAM );
+uint32_t float32_to_uint32_round_to_zero( float32 STATUS_PARAM );
 int64_t float32_to_int64( float32 STATUS_PARAM );
 int64_t float32_to_int64_round_to_zero( float32 STATUS_PARAM );
 float64 float32_to_float64( float32 STATUS_PARAM );
@@ -329,12 +316,12 @@  INLINE int float32_is_any_nan(float32 a)
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE double-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int float64_to_int16_round_to_zero( float64 STATUS_PARAM );
-unsigned int float64_to_uint16_round_to_zero( float64 STATUS_PARAM );
-int float64_to_int32( float64 STATUS_PARAM );
-int float64_to_int32_round_to_zero( float64 STATUS_PARAM );
-unsigned int float64_to_uint32( float64 STATUS_PARAM );
-unsigned int float64_to_uint32_round_to_zero( float64 STATUS_PARAM );
+int16_t float64_to_int16_round_to_zero( float64 STATUS_PARAM );
+uint16_t float64_to_uint16_round_to_zero( float64 STATUS_PARAM );
+int32_t float64_to_int32( float64 STATUS_PARAM );
+int32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM );
+uint32_t float64_to_uint32( float64 STATUS_PARAM );
+uint32_t float64_to_uint32_round_to_zero( float64 STATUS_PARAM );
 int64_t float64_to_int64( float64 STATUS_PARAM );
 int64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM );
 uint64_t float64_to_uint64 (float64 a STATUS_PARAM);
@@ -411,8 +398,8 @@  INLINE int float64_is_any_nan(float64 a)
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE extended double-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int floatx80_to_int32( floatx80 STATUS_PARAM );
-int floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM );
+int32_t floatx80_to_int32( floatx80 STATUS_PARAM );
+int32_t floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM );
 int64_t floatx80_to_int64( floatx80 STATUS_PARAM );
 int64_t floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM );
 float32 floatx80_to_float32( floatx80 STATUS_PARAM );
@@ -475,8 +462,8 @@  INLINE int floatx80_is_zero(floatx80 a)
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE quadruple-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int float128_to_int32( float128 STATUS_PARAM );
-int float128_to_int32_round_to_zero( float128 STATUS_PARAM );
+int32_t float128_to_int32( float128 STATUS_PARAM );
+int32_t float128_to_int32_round_to_zero( float128 STATUS_PARAM );
 int64_t float128_to_int64( float128 STATUS_PARAM );
 int64_t float128_to_int64_round_to_zero( float128 STATUS_PARAM );
 float32 float128_to_float32( float128 STATUS_PARAM );
diff --git a/hw/apic.c b/hw/apic.c
index a5a53fb..ff581f0 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -765,7 +765,7 @@  static uint32_t apic_mem_readl(void *opaque, target_phys_addr_t addr)
     return val;
 }
 
-static void apic_send_msi(target_phys_addr_t addr, uint32 data)
+static void apic_send_msi(target_phys_addr_t addr, uint32_t data)
 {
     uint8_t dest = (addr & MSI_ADDR_DEST_ID_MASK) >> MSI_ADDR_DEST_ID_SHIFT;
     uint8_t vector = (data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SHIFT;
diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c
index b6235eb..1248464 100644
--- a/hw/wdt_ib700.c
+++ b/hw/wdt_ib700.c
@@ -53,7 +53,7 @@  static void ib700_write_enable_reg(void *vp, uint32_t addr, uint32_t data)
         30, 28, 26, 24, 22, 20, 18, 16,
         14, 12, 10,  8,  6,  4,  2,  0
     };
-    int64 timeout;
+    int64_t timeout;
 
     ib700_debug("addr = %x, data = %x\n", addr, data);
 
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 06e40f3..f0c07cd 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -737,10 +737,10 @@  typedef struct CPUX86State {
        user */
     struct DeviceState *apic_state;
 
-    uint64 mcg_cap;
-    uint64 mcg_status;
-    uint64 mcg_ctl;
-    uint64 mce_banks[MCE_BANKS_DEF*4];
+    uint64_t mcg_cap;
+    uint64_t mcg_status;
+    uint64_t mcg_ctl;
+    uint64_t mce_banks[MCE_BANKS_DEF*4];
 
     uint64_t tsc_aux;