Commit 99a0846e authored by Fabian Bauer's avatar Fabian Bauer
Browse files

introduce FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2

parent 8cc9439e
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
    the United Nations Convention on Contracts on the International Sales of Goods.

*******************************************************************************************************/

#define FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2
#include <stdint.h>
#include "options.h"
#include <assert.h>
@@ -4613,7 +4613,32 @@ static void formulate2x2MixingMatrix_fx(

    pop_wmops(); /*push_wmops( "oPtoA MT1M" );*/

#ifdef FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2
    IF( D_fx[0] == 0 )
    {
#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC
        temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, 4611686, &exp ); // 4611686 = 1e-12 in Q62
        exp = sub( exp, sub( Q30, 62 ) );
#else
        temp = ONE_DIV_EPSILON_MANT; /* Result of 1.0/eps with full precision */
        move32();
        exp = ONE_DIV_EPSILON_EXP;
        move16();
#endif
        div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp
        move32();
    }
    ELSE
    {
        exp = sub( 31, q_D );
        div_fx[0] = ISqrt32( D_fx[0], &exp );

        //temp = BASOP_Util_Divide3232_Scale_cadence( ONE_IN_Q30, D_fx[0], &exp );
        //exp = sub( exp, sub( Q30, q_D ) );
        //div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp
        //move32();
    }
#else
    IF( D_fx[0] == 0 )
    {
#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC
@@ -4633,6 +4658,7 @@ static void formulate2x2MixingMatrix_fx(
    }
    div_fx[0] = Sqrt32( temp, &exp ); // Q = 31 - exp
    move32();
#endif /*FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2*/

#ifdef FIX_1326_SPEEDUP_08
    //Sqrt(1)