Commit 7ab17f07 authored by Fabian Bauer's avatar Fabian Bauer Committed by Sandesh Venkatesh
Browse files

introduce FIX_1326_SUBSTITUTE_DIV_SQRT_IOSQRT_2

parent 5f457907
Loading
Loading
Loading
Loading
+24 −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>
@@ -4563,6 +4563,28 @@ static void formulate2x2MixingMatrix_fx(

    eig2x2_fx( tmpRe_fx[0][0], tmpRe_fx[1][1], q_temp, tmpRe_fx[1][0], tmpIm_fx[1][0], q_temp, Ure_fx, Uim_fx, &q_U, D_fx, &q_D );


#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 );
    }
#else
    IF( D_fx[0] == 0 )
    {
#ifndef FIX_1009_REPLACE_DIV_SQRT_BY_ISQRT_LC
@@ -4582,6 +4604,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_SUBSTITUTE_DIV_SQRT_IOSQRT
    // Sqrt(1)