Ensure int32_t for clamps

This commit is contained in:
Simon Aarons 2020-08-16 12:36:59 +10:00 committed by GitHub
parent 8a5af7ccdb
commit 221c50b85c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,14 +33,14 @@ void decode_tgc(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int32_t first_samp
uint8_t nibble = ((uint8_t)read_8bit(i/2, stream->streamfile) >>
(i & 1 ? 4 : 0)) & 0xf;
stream->adpcm_history1_16 += slope_table[stream->adpcm_step_index][nibble];
stream->adpcm_history1_32 += slope_table[stream->adpcm_step_index][nibble];
stream->adpcm_step_index = next_step [stream->adpcm_step_index][nibble];
if (stream->adpcm_history1_16 < -32768)
stream->adpcm_history1_16 = -32768;
if (stream->adpcm_history1_32 < -32768)
stream->adpcm_history1_32 = -32768;
if (stream->adpcm_history1_16 > 32767)
stream->adpcm_history1_16 = 32767;
if (stream->adpcm_history1_32 > 32767)
stream->adpcm_history1_32 = 32767;
outbuf[sample_count] = stream->adpcm_history1_16;
}