Commit 5b2fa6dd authored by malenov's avatar malenov
Browse files

fix discrepancy between Windows and Linux

parent 93cdb82c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -392,12 +392,16 @@ Word16 shl_ro( Word16 var1, Word16 var2, Flag *Overflow )
        var2 = -var2;
        var_out = shr_ro( var1, var2, Overflow );
#ifdef WMOPS
#ifndef FIX_SHR_RO_COMPLEXITY
        multiCounter[currCounter].shr_r--;
#endif
#endif /* ifdef WMOPS */
    }

#ifdef WMOPS
#ifndef FIX_SHR_RO_COMPLEXITY
    multiCounter[currCounter].shl_r++;
#endif
#endif /* ifdef WMOPS */

    return ( var_out );
+3 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@
#define NON_BE_FIX_807_MASA_DTX_BRSW                     /* Nokia: adds fix to check existence of DTX encoder for secondary channel in TD mode */
#define FIX_BASOP_812_NAN_COHSNR                        /* FhG: BASOP issue 812: fix nan values in sparse frames for cohSNR value in ITD estimation*/
#define FIX_828_PORT_1152_FROM_FLT_REPO                  /* FhG: fix for issue 828 - fix uninitialized value used in BASOP */
#define FIX_SHR_RO_COMPLEXITY                           /* VA: fix for issue 1049: incorrect counting of complexity in the shr_ro() function */
#define FIX_IF_ELSE_CMPLX_DISCREPANCY                   /* fix IF-ELSE discpreancy within the Copy() function depending on memory locations of x[] and y[] */

/* #################### End FIXES switches ############################ */

#define BASOP_NOGLOB                                    /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */
+20 −0
Original line number Diff line number Diff line
@@ -488,7 +488,12 @@ void Copy(
            move16();
        }
    }

#ifdef FIX_IF_ELSE_CMPLX_DISCREPANCY
    IF( y >= x )
#else
    ELSE
#endif
    {
        FOR( i = L - 1; i >= 0; i-- )
        {
@@ -517,7 +522,12 @@ void Copy64(
            move64();
        }
    }

#ifdef FIX_IF_ELSE_CMPLX_DISCREPANCY
    IF( y >= x )
#else
    ELSE
#endif
    {
        FOR( i = L - 1; i >= 0; i-- )
        {
@@ -561,7 +571,12 @@ void Copy_pword(
            move16();
        }
    }

#ifdef FIX_IF_ELSE_CMPLX_DISCREPANCY
    IF( y >= x )
#else
    ELSE
#endif
    {
        FOR( i = L - 1; i >= 0; i-- )
        {
@@ -592,7 +607,12 @@ void Copy32(
            move32();
        }
    }

#ifdef FIX_IF_ELSE_CMPLX_DISCREPANCY
    IF( y >= x )
#else
    ELSE
#endif
    {
        FOR( i = L - 1; i >= 0; i-- )
        {
+65 −64
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ int cntr_push_pop = 0; /* global counter for checking balanced push_wmops()/pop_
#define DOUBLE_MAX                   0x80000000
#define FAC                          ( FRAMES_PER_SECOND / 1e6 )

#define FRAMES_PER_SECOND 50.0
#define PROM_INST_SIZE    32 /* number of bits of each program instruction when stored in the PROM memory (applied only when the user selects reporting in bytes) */

typedef struct
{
    char label[MAX_FUNCTION_NAME_LENGTH];
@@ -89,6 +92,65 @@ static long fnum_cnt_wc;
static int *wmops_caller_stack = NULL, wmops_caller_stack_index, max_wmops_caller_stack_index = 0;
static int *heap_allocation_call_tree = NULL, heap_allocation_call_tree_size = 0, heap_allocation_call_tree_max_size = 0;

static BASIC_OP op_weight = {
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 2, 2, 1,
    1, 1, 1, 2, 1,

    1, 1, 1, 2, 1,
    1, 1, 18, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    2, 2, 2, 2, 1,

    1, 1, 1, 1, 1,
    1, 1, 1, 2,
    1, 2, 2, 2, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,

    1, 1, 1, 1, 3,
    3, 3, 3, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 3, 2,
    2, 6, 3, 3, 2,

    1, 32, 1

/* New complex basops */
#ifdef COMPLEX_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1

    ,
    1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1

#endif /* #ifdef COMPLEX_OPERATOR */

#ifdef ENH_64_BIT_OPERATOR
    /* Weights of new 64 bit basops */
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_64_BIT_OPERATOR */

#ifdef ENH_32_BIT_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_32_BIT_OPERATOR */

#ifdef ENH_U_32_BIT_OPERATOR
    ,
    1, 1, 1, 2, 2, 1, 1
#endif /* #ifdef ENH_U_32_BIT_OPERATOR */

#ifdef CONTROL_CODE_OPS
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef CONTROL_CODE_OPS */
};

BASIC_OP *multiCounter = NULL;
int currCounter = 0;
int funcId_where_last_call_to_else_occurred;
@@ -192,7 +254,7 @@ void reset_wmops( void )

    /* initialize auxiliary BASOP WMOPS variables */
    call_occurred = 1;
    funcId_where_last_call_to_else_occurred = INT_MAX;
    funcId_where_last_call_to_else_occurred = -100;

    return;
}
@@ -322,7 +384,6 @@ void push_wmops_fct( const char *label, ... )
    return;
}


void pop_wmops( void )
{
    long tot;
@@ -447,7 +508,7 @@ void update_wmops( void )
        wmops[i].current_call_number = 0;
#endif

        /* update the WC of all BASOP counters */
        /* reset the BASOP counter */
        Set_BASOP_WMOPS_counter( i );
        Reset_BASOP_WMOPS_counter();
    }
@@ -2120,66 +2181,6 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )

#endif /* WMOPS */


BASIC_OP op_weight = {
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 2, 2, 1,
    1, 1, 1, 2, 1,

    1, 1, 1, 2, 1,
    1, 1, 18, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    2, 2, 2, 2, 1,

    1, 1, 1, 1, 1,
    1, 1, 1, 2,
    1, 2, 2, 2, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,

    1, 1, 1, 1, 3,
    3, 3, 3, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 3, 2,
    2, 6, 3, 3, 2,

    1, 32, 1

/* New complex basops */
#ifdef COMPLEX_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1

    ,
    1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1

#endif /* #ifdef COMPLEX_OPERATOR */

#ifdef ENH_64_BIT_OPERATOR
    /* Weights of new 64 bit basops */
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_64_BIT_OPERATOR */

#ifdef ENH_32_BIT_OPERATOR
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef ENH_32_BIT_OPERATOR */

#ifdef ENH_U_32_BIT_OPERATOR
    ,
    1, 1, 1, 2, 2, 1, 1
#endif /* #ifdef ENH_U_32_BIT_OPERATOR */

#ifdef CONTROL_CODE_OPS
    ,
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
#endif /* #ifdef CONTROL_CODE_OPS */
};

#ifdef CONTROL_CODE_OPS

int LT_16( short var1, short var2 )
+4 −8
Original line number Diff line number Diff line
@@ -30,14 +30,8 @@
#pragma GCC system_header
#endif

#ifndef INT_MAX
#define INT_MAX 32767
#endif

#define CONTROL_CODE_OPS /* enable control code operators such as LT_16, GT_16, ... */

#define FRAMES_PER_SECOND 50.0
#define PROM_INST_SIZE    32 /* number of bits of each program instruction when stored in the PROM memory (applied only when the user selects reporting in bytes) */

#ifdef WMOPS
enum instructions
@@ -1407,6 +1401,7 @@ static __inline void incrWhile( void )
 *  Complexity weight : 4
 *
 *****************************************************************************/

#ifndef WMOPS
#define IF( a ) if ( a )

@@ -1423,7 +1418,7 @@ static __inline void incrIf( void )
        multiCounter[currCounter].If++;

    call_occurred = 0;
    funcId_where_last_call_to_else_occurred = INT_MAX;
    funcId_where_last_call_to_else_occurred = -100;
}
#endif /* ifndef WMOPS */

@@ -1439,6 +1434,7 @@ static __inline void incrIf( void )
 *  Complexity weight : 4
 *
 *****************************************************************************/

#ifndef WMOPS
#define ELSE else