Commit c41a883c authored by Manuel Jander's avatar Manuel Jander
Browse files

Issue #1010 : Add output normalization and x==0 handling to BASOP_Util_Inv32...

Issue #1010 : Add output normalization and x==0 handling to BASOP_Util_Inv32 to prevent instabilities for some operating points.
parent ca43c4f5
Loading
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1049,8 +1049,8 @@ Word32 BASOP_Util_Inv32(Word32 x, Word16 *px_e)
    /* Avoid result 0 with inconvenient exponent returned. */
    IF( x == (Word32) 0 )
    {
        *px_e = 0;
        return ( (Word32) 0 );
        *px_e = 31;
        return ( (Word32) MAX_32 );
    }

    sign = 0;
@@ -1086,6 +1086,13 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )

#ifdef OPT_BASOP_Util_Divide3232_Scale_cadence
    Word16 shift, s2;

    IF( x == (Word32) 0 )
    {
        *s = 0;
        return ( (Word32) 0 );
    }

    z = BASOP_Util_Inv32(y, &s2);
    shift = norm_l(x);
    z = Mpy_32_32_r(L_shl(x, shift), z);