kernels/linux-2.4.0/arch/arm/nwfpe/softfloat.c
/*
-------------------------------------------------------------------------------
Returns the result of converting the single-precision floating-point value
`a' to the 32-bit two's complement integer format.  The conversion is
performed according to the IEC/IEEE Standard for Binary Floating-point
Arithmetic, except that the conversion is always rounded toward zero.  If
`a' is a NaN, the largest positive integer is returned.  Otherwise, if the
conversion overflows, the largest integer with the same sign as `a' is
returned.
-------------------------------------------------------------------------------
*/
Returns the result of converting the single-precision floating-point value
`a' to the 32-bit two's complement integer format.  The conversion is
performed according to the IEC/IEEE Standard for Binary Floating-point
Arithmetic, except that the conversion is always rounded toward zero.  If
`a' is a NaN, the largest positive integer is returned.  Otherwise, if the
conversion overflows, the largest integer with the same sign as `a' is
returned.
Returns the result of converting the single - precision floating - point value ` a ' to the 32 - bit two ' s complement integer format . The conversion is performed according to the IEC / IEEE Standard for Binary Floating - point Arithmetic except that the conversion is always rounded toward zero . If ` a ' is a NaN the largest positive integer is returned . Otherwise if the conversion overflows the largest integer with the same sign as ` a ' is returned .
int32 float32_to_int32_round_to_zero( float32 a )
{
    flag aSign;
    int16 aExp, shiftCount;
    bits32 aSig;
    int32 z;
    aSig = extractFloat32Frac( a );
    aExp = extractFloat32Exp( a );
    aSign = extractFloat32Sign( a );
    shiftCount = aExp - 0x9E;
    if ( 0 <= shiftCount ) {
        if ( a == 0xCF000000 ) return 0x80000000;
        float_raise( float_flag_invalid );
        if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) return 0x7FFFFFFF;
        return 0x80000000;
    }
    else if ( aExp <= 0x7E ) {
        if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
        return 0;
    }
    aSig = ( aSig | 0x00800000 )<<8;
    z = aSig>>( - shiftCount );
    if ( (bits32) ( aSig<<( shiftCount & 31 ) ) ) {
        float_exception_flags |= float_flag_inexact;
    }
    return aSign ? - z : z;
}
int32 float32_to_int32_round_to_zero ( float32 a ) { flag aSign ; int16 aExp , shiftCount ; bits32 aSig ; int32 z ; aSig = extractFloat32Frac ( a ) ; aExp = extractFloat32Exp ( a ) ; aSign = extractFloat32Sign ( a ) ; shiftCount = aExp - 0x9E ; if ( 0 <= shiftCount ) { if ( a == 0xCF000000 ) return 0x80000000 ; float_raise ( float_flag_invalid ) ; if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) return 0x7FFFFFFF ; return 0x80000000 ; } else if ( aExp <= 0x7E ) { if ( aExp | aSig ) float_exception_flags |= float_flag_inexact ; return 0 ; } aSig = ( aSig | 0x00800000 ) << 8 ; z = aSig >> ( - shiftCount ) ; if ( ( bits32 ) ( aSig << ( shiftCount & 31 ) ) ) { float_exception_flags |= float_flag_inexact ; } return aSign ? - z : z ; }
Returns the result of converting the single-precision floating-point value
`a' to the 32-bit two's complement integer format.
Returns the result of converting the single - precision floating - point value ` a ' to the 32 - bit two ' s complement integer format .