diff options
author | Chris Robinson <[email protected]> | 2019-12-11 02:44:05 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-12-11 02:44:05 -0800 |
commit | ac7a5dcbfa7d913af9ef705a99e146bfcb290b41 (patch) | |
tree | 0c718f7e5649f4996bb6b7fbda53395f63a3a248 /alc | |
parent | 053de623987c7ca6b1e44e781bc5228825622f70 (diff) |
Use size_t for array indices
Diffstat (limited to 'alc')
-rw-r--r-- | alc/mixer/mixer_sse.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/alc/mixer/mixer_sse.cpp b/alc/mixer/mixer_sse.cpp index 4458f9a0..2fb856e1 100644 --- a/alc/mixer/mixer_sse.cpp +++ b/alc/mixer/mixer_sse.cpp @@ -33,9 +33,9 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const ALuint IrSize, const Hrir imp0 = _mm_mul_ps(lrlr, coeffs); vals = _mm_add_ps(imp0, vals); _mm_storel_pi(reinterpret_cast<__m64*>(&Values[0][0]), vals); - ALuint i{1}; - for(;i < IrSize-1;i += 2) - { + ALuint td{(IrSize>>1) - 1}; + size_t i{1}; + do { coeffs = _mm_load_ps(&Coeffs[i+1][0]); vals = _mm_load_ps(&Values[i][0]); imp1 = _mm_mul_ps(lrlr, coeffs); @@ -43,7 +43,8 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const ALuint IrSize, const Hrir vals = _mm_add_ps(imp0, vals); _mm_store_ps(&Values[i][0], vals); imp0 = imp1; - } + i += 2; + } while(--td); vals = _mm_loadl_pi(vals, reinterpret_cast<__m64*>(&Values[i][0])); imp0 = _mm_movehl_ps(imp0, imp0); vals = _mm_add_ps(imp0, vals); @@ -51,9 +52,9 @@ inline void ApplyCoeffs(float2 *RESTRICT Values, const ALuint IrSize, const Hrir } else { - for(ALuint i{0};i < IrSize;i += 2) + for(size_t i{0};i < IrSize;i += 2) { - __m128 coeffs{_mm_load_ps(&Coeffs[i][0])}; + const __m128 coeffs{_mm_load_ps(&Coeffs[i][0])}; __m128 vals{_mm_load_ps(&Values[i][0])}; vals = _mm_add_ps(vals, _mm_mul_ps(lrlr, coeffs)); _mm_store_ps(&Values[i][0], vals); |