Hively Replayer: Fix undefined behavior

Shifting negative numbers to the left is undefined behavior, so replace
with a multiply operation instead.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-03-06 03:53:28 -08:00
parent 014f136b7e
commit ab8154348e
1 changed files with 3 additions and 3 deletions

View File

@ -143,12 +143,12 @@ void hvl_GenFilterWaves( int8 *buf, int8 *lowbuf, int8 *highbuf )
int32 in, fre, high, mid, low; int32 in, fre, high, mid, low;
uint32 j; uint32 j;
mid = *mid_table++ << 8; mid = *mid_table++ * (1 << 8);
low = *low_table++ << 8; low = *low_table++ * (1 << 8);
for( j=0; j<=lentab[wv]; j++ ) for( j=0; j<=lentab[wv]; j++ )
{ {
in = a0[j] << 16; in = a0[j] * (1 << 16);
high = clipshifted8( in - mid - low ); high = clipshifted8( in - mid - low );
fre = (high >> 8) * freq; fre = (high >> 8) * freq;
mid = clipshifted8(mid + fre); mid = clipshifted8(mid + fre);