Commit 20cd4337 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

Merge branch '1796-replace-shl_o-by-overflow-free-alternatives' into...

Merge branch '1796-replace-shl_o-by-overflow-free-alternatives' into 1836-replace-overflow-basop-operators-by-overflow-free-variants-in-lib_com
parents 9ae3c7f7 6c5311a0
Loading
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -989,20 +989,7 @@ Word16 E_LPC_f_lsp_pol_get( const Word16 lsp[], Word32 f[], const Word16 n, cons
    /*b = -2.0f * *plsp;*/
    b = *plsp;
    move16();
#ifdef ISSUE_1796_replace_shl_o
    m2 = shl_sat( -2, sub( 15, Q_out ) );

    /* There's only 1 integer to solve -32768 = -2 * 2^y, y = 14 .
     * so we can assume a saturated overflow, if -2 * 2^y = -32768 and y is not 14.
     */
    test();
    IF( m2 == MIN_16 && Q_out != 1 )
    {
        Overflow = 1;
    }
#else
    m2 = shl_o( -2, sub( 15, Q_out ), &Overflow );
#endif
    f[1] = L_mult_o( b, m2, &Overflow );
    move32();

+0 −9
Original line number Diff line number Diff line
@@ -565,15 +565,6 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn
    BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1796_replace_shl_o
    gain = shl_sat( gain, i ); /* saturation can occur here */

    /* There's only 1 integer x to solve 32767 = x * 2^y, if y is an integer : x= 32767 and y = 0 .
     * so we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: y == 0 or x == 32767 .
     */
    test();
    IF( gain == MAX_16 && i != 0 )
    {
        Overflow = 1;
    }
#else
    gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */
#endif
+0 −14
Original line number Diff line number Diff line
@@ -521,21 +521,7 @@ Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX)
        xy = shr( xy, 1 );      /* be sure that xy < yy */
        gain = div_s( xy, yy ); // Q15
        i = sub( exp_xy, exp_yy );
#ifdef ISSUE_1796_replace_shl_o
        gain = shl_sat( gain, i ); /* saturation can occur here */

        /*
                Theres only one x, to solve 32767 = x * 2 ^ y, if y is an integer : x = 32767 and y = 0 .
                So we can assume a saturated overflow, if gain == 32767 and one of the two conditions is false: x == 32767 or y == 0
        */
        test();
        IF( gain == MAX_16 && i != 0 )
        {
            Overflow = 1;
        }
#else
        gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */
#endif
        *Overflow_out |= Overflow;
        move16();