Commit 28168de6 authored by ber's avatar ber
Browse files

add missing changes to last commit

parent 5f12d077
Loading
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -429,6 +429,7 @@ static Word16 ISqrt16_common( Word16 m,
}

/* local function for ISqrt32 and ISqrt32norm */
#define ISqrt32_common_INCREASEPRECISION
static Word32 ISqrt32_common( Word32 m,
                              Word16 e )
{
@@ -438,26 +439,43 @@ static Word32 ISqrt32_common( Word32 m,
#endif

    assert( m >= 0x40000000 );

#ifndef ISqrt32_common_INCREASEPRECISION
#ifdef BASOP_NOGLOB
    m16 = round_fx_o( m, &Overflow );
#else
    m16 = round_fx( m );
#endif
#endif

    /* get table index (upper 6 bits minus 32) */
    /* index = (m16 >> 25) - 32; */
#ifndef ISqrt32_common_INCREASEPRECISION
    index = mac_r( -32768 - ( 32 << 16 ), m16, 1 << 6 );
#else
    index = mac_r( -32768 - ( 32 << 16 ), L_shr( m, 16 ), 1 << 6 );
#endif


#ifdef ISqrt32_common_INCREASEPRECISION /*plusmoreprec*/
    /* interpolate */
    Word32 frac32 = L_and( m, 0x1FFFFFF );
    m = L_sub( ISqrtTable[index], Mpy_32_16_r( frac32, ISqrtDiffTable[index] ) );
#else
    /* get fractional part for interpolation (lower 9 bits) */
    frac = s_and( m16, 0x1FF ); /* Q9 */

    /* interpolate */
    m = L_msu( ISqrtTable[index], ISqrtDiffTable[index], frac );
#endif

    /* handle even exponents */
    if ( s_and( e, 1 ) == 0 )
#ifndef ISqrt32_common_INCREASEPRECISION
        m = Mpy_32_16_1( m, 0x5a82 );
#else
        m = Mpy_32_32_r( m, 0x5A82799A );
#endif
    

    return m;
}