Fix UBSan errors (left shift of negative value)

BUG=chromium:603501

Review-Url: https://codereview.webrtc.org/1988723002
Cr-Commit-Position: refs/heads/master@{#12775}
This commit is contained in:
kwiberg
2016-05-17 06:40:41 -07:00
committed by Commit bot
parent aa08ce6892
commit 9b2228fdfc
2 changed files with 6 additions and 6 deletions

View File

@ -48,7 +48,7 @@ void WebRtcIlbcfix_HpOutput(
tmpW32 = (tmpW32>>15);
tmpW32 += y[0] * ba[3]; /* (-a[1])*y[i-1] (high part) */
tmpW32 += y[2] * ba[4]; /* (-a[2])*y[i-2] (high part) */
tmpW32 = (tmpW32<<1);
tmpW32 *= 2;
tmpW32 += signal[i] * ba[0]; /* b[0]*x[0] */
tmpW32 += x[0] * ba[1]; /* b[1]*x[i-1] */
@ -77,11 +77,11 @@ void WebRtcIlbcfix_HpOutput(
} else if (tmpW32<-268435456) {
tmpW32 = WEBRTC_SPL_WORD32_MIN;
} else {
tmpW32 <<= 3;
tmpW32 *= 8;
}
y[0] = (int16_t)(tmpW32 >> 16);
y[1] = (int16_t)((tmpW32 - (y[0] << 16)) >> 1);
y[1] = (int16_t)((tmpW32 & 0xffff) >> 1);
}