diff options
| author | christos <christos@NetBSD.org> | 2012-03-21 02:32:26 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2012-03-21 02:32:26 +0000 |
| commit | 4c024d7b8ec60afe62a6710c80bb6fb2fd68dd67 (patch) | |
| tree | 200742263d50dfaa803bf5aa89c1bcadd737f6d7 /lib/libc/softfloat/bits64/softfloat.c | |
| parent | d5d609c9065b069f7ea37ebe3889b9951c40ef66 (diff) | |
cast to appropriate types.
Diffstat (limited to 'lib/libc/softfloat/bits64/softfloat.c')
| -rw-r--r-- | lib/libc/softfloat/bits64/softfloat.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/libc/softfloat/bits64/softfloat.c b/lib/libc/softfloat/bits64/softfloat.c index fc82a58eefb..828e88273b0 100644 --- a/lib/libc/softfloat/bits64/softfloat.c +++ b/lib/libc/softfloat/bits64/softfloat.c @@ -1,4 +1,4 @@ -/* $NetBSD: softfloat.c,v 1.9 2012/03/20 21:34:51 martin Exp $ */ +/* $NetBSD: softfloat.c,v 1.10 2012/03/21 02:32:26 christos Exp $ */ /* * This version hacked for use with gcc -msoft-float by bjh21. @@ -46,7 +46,7 @@ this code that are retained. #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: softfloat.c,v 1.9 2012/03/20 21:34:51 martin Exp $"); +__RCSID("$NetBSD: softfloat.c,v 1.10 2012/03/21 02:32:26 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef SOFTFLOAT_FOR_GCC @@ -137,10 +137,10 @@ static int32 roundAndPackInt32( flag zSign, bits64 absZ ) } } } - roundBits = absZ & 0x7F; + roundBits = (int8)(absZ & 0x7F); absZ = ( absZ + roundIncrement )>>7; absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); - z = absZ; + z = (int32)absZ; if ( zSign ) z = - z; if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) { float_raise( float_flag_invalid ); @@ -340,7 +340,7 @@ static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig ) isTiny = ( float_detect_tininess == float_tininess_before_rounding ) || ( zExp < -1 ) - || ( zSig + roundIncrement < 0x80000000 ); + || ( zSig + roundIncrement < 0x80000000U ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; @@ -395,7 +395,7 @@ Returns the exponent bits of the double-precision floating-point value `a'. INLINE int16 extractFloat64Exp( float64 a ) { - return ( FLOAT64_DEMANGLE(a)>>52 ) & 0x7FF; + return (int16)((FLOAT64_DEMANGLE(a) >> 52) & 0x7FF); } @@ -407,7 +407,7 @@ Returns the sign bit of the double-precision floating-point value `a'. INLINE flag extractFloat64Sign( float64 a ) { - return FLOAT64_DEMANGLE(a)>>63; + return (flag)(FLOAT64_DEMANGLE(a) >> 63); } @@ -497,7 +497,7 @@ static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig ) } } } - roundBits = zSig & 0x3FF; + roundBits = (int16)(zSig & 0x3FF); if ( 0x7FD <= (bits16) zExp ) { if ( ( 0x7FD < zExp ) || ( ( zExp == 0x7FD ) @@ -512,10 +512,10 @@ static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig ) isTiny = ( float_detect_tininess == float_tininess_before_rounding ) || ( zExp < -1 ) - || ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) ); + || ( zSig + roundIncrement < (bits64)LIT64( 0x8000000000000000 ) ); shift64RightJamming( zSig, - zExp, &zSig ); zExp = 0; - roundBits = zSig & 0x3FF; + roundBits = (int16)(zSig & 0x3FF); if ( isTiny && roundBits ) float_raise( float_flag_underflow ); } } @@ -876,7 +876,7 @@ Returns the exponent bits of the quadruple-precision floating-point value INLINE int32 extractFloat128Exp( float128 a ) { - return ( a.high>>48 ) & 0x7FFF; + return (int32)((a.high >> 48) & 0x7FFF); } @@ -888,7 +888,7 @@ Returns the sign bit of the quadruple-precision floating-point value `a'. INLINE flag extractFloat128Sign( float128 a ) { - return a.high>>63; + return (flag)(a.high >> 63); } @@ -1124,7 +1124,7 @@ float32 int32_to_float32( int32 a ) if ( a == 0 ) return 0; if ( a == (sbits32) 0x80000000 ) return packFloat32( 1, 0x9E, 0 ); zSign = ( a < 0 ); - return normalizeRoundAndPackFloat32( zSign, 0x9C, zSign ? - a : a ); + return normalizeRoundAndPackFloat32(zSign, 0x9C, (uint32)(zSign ? - a : a)); } @@ -1936,7 +1936,7 @@ float32 float32_mul( float32 a, float32 b ) aSig = ( aSig | 0x00800000 )<<7; bSig = ( bSig | 0x00800000 )<<8; shift64RightJamming( ( (bits64) aSig ) * bSig, 32, &zSig64 ); - zSig = zSig64; + zSig = (bits32)zSig64; if ( 0 <= (sbits32) ( zSig<<1 ) ) { zSig <<= 1; --zExp; @@ -2000,7 +2000,7 @@ float32 float32_div( float32 a, float32 b ) aSig >>= 1; ++zExp; } - zSig = ( ( (bits64) aSig )<<32 ) / bSig; + zSig = (bits32)(((bits64) aSig) << 32) / bSig; if ( ( zSig & 0x3F ) == 0 ) { zSig |= ( (bits64) bSig * zSig != ( (bits64) aSig )<<32 ); } @@ -2379,7 +2379,7 @@ int32 float64_to_int32_round_to_zero( float64 a ) shiftCount = 0x433 - aExp; savedASig = aSig; aSig >>= shiftCount; - z = aSig; + z = (int32)aSig; if ( aSign ) z = - z; if ( ( z < 0 ) ^ aSign ) { invalid: @@ -2514,7 +2514,7 @@ float32 float64_to_float32( float64 a ) return packFloat32( aSign, 0xFF, 0 ); } shift64RightJamming( aSig, 22, &aSig ); - zSig = aSig; + zSig = (bits32)aSig; if ( aExp || zSig ) { zSig |= 0x40000000; aExp -= 0x381; @@ -4362,7 +4362,7 @@ int32 float128_to_int32_round_to_zero( float128 a ) shiftCount = 0x402F - aExp; savedASig = aSig0; aSig0 >>= shiftCount; - z = aSig0; + z = (int32)aSig0; if ( aSign ) z = - z; if ( ( z < 0 ) ^ aSign ) { invalid: @@ -4562,7 +4562,7 @@ float32 float128_to_float32( float128 a ) } aSig0 |= ( aSig1 != 0 ); shift64RightJamming( aSig0, 18, &aSig0 ); - zSig = aSig0; + zSig = (bits32)aSig0; if ( aExp || zSig ) { zSig |= 0x40000000; aExp -= 0x3F81; @@ -5255,9 +5255,9 @@ float128 float128_sqrt( float128 a ) if ( ( aSig0 | aSig1 ) == 0 ) return packFloat128( 0, 0, 0, 0 ); normalizeFloat128Subnormal( aSig0, aSig1, &aExp, &aSig0, &aSig1 ); } - zExp = ( ( aExp - 0x3FFF )>>1 ) + 0x3FFE; + zExp = ( (unsigned int)(aExp - 0x3FFF) >> 1) + 0x3FFE; aSig0 |= LIT64( 0x0001000000000000 ); - zSig0 = estimateSqrt32( aExp, aSig0>>17 ); + zSig0 = estimateSqrt32((int16)aExp, (bits32)(aSig0>>17)); shortShift128Left( aSig0, aSig1, 13 - ( aExp & 1 ), &aSig0, &aSig1 ); zSig0 = estimateDiv128To64( aSig0, aSig1, zSig0<<32 ) + ( zSig0<<30 ); doubleZSig0 = zSig0<<1; @@ -5542,7 +5542,7 @@ uint32 float64_to_uint32_round_to_zero( float64 a ) shiftCount = 0x433 - aExp; savedASig = aSig; aSig >>= shiftCount; - z = aSig; + z = (uint32)aSig; if ( ( aSig<<shiftCount ) != savedASig ) { float_exception_flags |= float_flag_inexact; } |
