Loading lib_com/float_to_fix_ops.c +3 −2 Original line number Diff line number Diff line Loading @@ -15,9 +15,9 @@ Word32 floatToFixed( float f, Word16 Q ) if ( f == 1.0f && Q == Q31 ) return MAXVAL_WORD32; if ( Q < 0 ) result_32 = (Word64) ( (float) ( f ) / (double) ( (Word64) 1 << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) ); result_32 = (Word64) ( (float) ( f ) / (double) ( (unsigned Word64) 1 << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) ); else result_32 = (Word64) ( f * (double) ( (Word64) 1 << Q ) + ( f >= 0 ? 0.5 : -0.5 ) ); result_32 = (Word64) ( f * (double) ( (unsigned Word64) 1 << Q ) + ( f >= 0 ? 0.5 : -0.5 ) ); if ( result_32 > MAX_32 ) return MAX_32; if ( result_32 < MIN_32 ) Loading @@ -25,6 +25,7 @@ Word32 floatToFixed( float f, Word16 Q ) return (Word32) result_32; } float fixedToFloat( Word32 i, Word16 Q ) { if ( Q < 0 ) Loading Loading
lib_com/float_to_fix_ops.c +3 −2 Original line number Diff line number Diff line Loading @@ -15,9 +15,9 @@ Word32 floatToFixed( float f, Word16 Q ) if ( f == 1.0f && Q == Q31 ) return MAXVAL_WORD32; if ( Q < 0 ) result_32 = (Word64) ( (float) ( f ) / (double) ( (Word64) 1 << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) ); result_32 = (Word64) ( (float) ( f ) / (double) ( (unsigned Word64) 1 << ( -Q ) ) + ( f >= 0 ? 0.5 : -0.5 ) ); else result_32 = (Word64) ( f * (double) ( (Word64) 1 << Q ) + ( f >= 0 ? 0.5 : -0.5 ) ); result_32 = (Word64) ( f * (double) ( (unsigned Word64) 1 << Q ) + ( f >= 0 ? 0.5 : -0.5 ) ); if ( result_32 > MAX_32 ) return MAX_32; if ( result_32 < MIN_32 ) Loading @@ -25,6 +25,7 @@ Word32 floatToFixed( float f, Word16 Q ) return (Word32) result_32; } float fixedToFloat( Word32 i, Word16 Q ) { if ( Q < 0 ) Loading