Commit e1962f29 authored by vaillancour's avatar vaillancour
Browse files

Fix part 4 of specific OV

parent ee418501
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -68,10 +68,16 @@ void HBAutocorrelation(
            move16();
            L_tmp = L_msu0( 0, y[i], y[i] );
            L_tmp = L_shr( L_tmp, 1 );
#ifdef BASOP_NOGLOB  /* Only the sub can overflow is the current L_sum is negative and already close to MIN */
            L_sum = L_add( L_shr( L_sub_o( L_sum, 1, &Overflow ), 1 ), 1 );
#else
            L_sum = L_add( L_shr( L_sub( L_sum, 1 ), 1 ), 1 );

#endif
#ifdef BASOP_NOGLOB
            L_sum = L_sub_o( L_sum, L_tmp, &Overflow );
#else
            L_sum = L_sub( L_sum, L_tmp );

#endif
            FOR (j = add(i,1); j<len; j++)
            {
                L_tmp = L_msu0( 0, y[j], y[j] );
@@ -89,9 +95,17 @@ void HBAutocorrelation(
                    move16();
                    shift = add( shift, 1 );
                    L_tmp = L_shr( L_tmp, 1 );
#ifdef BASOP_NOGLOB  /* Only the sub can overflow is the current L_sum is negative and already close to MIN */
                    L_sum = L_add( L_shr( L_sub_o( L_sum, 1, &Overflow ), 1 ), 1 );
#else
                    L_sum = L_add( L_shr( L_sub( L_sum, 1 ), 1 ), 1 );
#endif
                }
#ifdef BASOP_NOGLOB
                L_sum = L_sub_o( L_sum, L_tmp, &Overflow );
#else
                L_sum = L_sub( L_sum, L_tmp );
#endif
            }
            BREAK;
        }