Commit 49c86008 authored by vaillancour's avatar vaillancour
Browse files

Fix critical carry/overflow

parent eb0d505f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -826,6 +826,19 @@ Word16 ApplyFdCng (
            {

                Carry = 0;
#ifdef BASOP_NOGLOB /* Critical Carry/Overflow */
                L_tmp = L_add_co(L_tmp,*(cngNoiseLevel+j), &Carry, &Overflow);
                Overflow = 0;

                if(*(cngNoiseLevel+j) < 0)
                {
                    L_c = L_msuNs_co(L_c,0,0, &Carry, &Overflow);
                }
                if(*(cngNoiseLevel+j) >= 0)
                {
                    L_c = L_macNs_co(L_c,0,0, &Carry, &Overflow);
                }
#else
                L_tmp = L_add_c(L_tmp,*(cngNoiseLevel+j));
                Overflow = 0;

@@ -837,6 +850,7 @@ Word16 ApplyFdCng (
                {
                    L_c = L_macNs(L_c,0,0);
                }
#endif
            }
            L_tmp = norm_llQ31(L_c,L_tmp,&L_tmp_exp);
            L_tmp_exp = sub(add(L_tmp_exp,*cngNoiseLevel_exp),1);