From 564a1822595e287cf808ea63a03d96719e3cc7b4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 24 Dec 2012 05:49:44 -0800 Subject: Avoid an underflow in the SSE mixers if BufferSize is less than 4 --- Alc/mixer_sse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Alc') diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 540a0d72..3c45fd21 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -155,7 +155,7 @@ void MixDirect_SSE(const DirectParams *params, const ALfloat *RESTRICT data, ALu ClickRemoval[c] -= data[0]*DrySend; gain = _mm_set1_ps(DrySend); - for(pos = 0;pos < BufferSize-3;pos += 4) + for(pos = 0;BufferSize-pos > 3;pos += 4) { const __m128 val4 = _mm_load_ps(&data[pos]); __m128 dry4 = _mm_load_ps(&DryBuffer[c][OutPos+pos]); @@ -189,7 +189,7 @@ void MixSend_SSE(const SendParams *params, const ALfloat *RESTRICT data, WetClickRemoval[0] -= data[0] * WetGain; gain = _mm_set1_ps(WetGain); - for(pos = 0;pos < BufferSize-3;pos+=4) + for(pos = 0;BufferSize-pos > 3;pos += 4) { const __m128 val4 = _mm_load_ps(&data[pos]); __m128 wet4 = _mm_load_ps(&WetBuffer[0][OutPos+pos]); -- cgit v1.2.3