From 7fc3a1012eedccc8ac125dc38f0c4e2f5af0458c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 27 Apr 2023 01:16:09 -0700 Subject: Use a static_cast for older versions of MSVC --- core/voice.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/voice.cpp b/core/voice.cpp index 35e03809..6a747f85 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -289,6 +289,7 @@ inline void LoadSamples(float *RESTRICT dstSamples, const al::byte *src /* NOTE: This could probably be optimized better. */ size_t wrote{0}; do { + static constexpr int MaxStepIndex{static_cast(al::size(IMAStep_size)) - 1}; /* Each IMA4 block starts with a signed 16-bit sample, and a signed * 16-bit table index. The table index needs to be clamped. */ @@ -296,7 +297,7 @@ inline void LoadSamples(float *RESTRICT dstSamples, const al::byte *src int index{src[srcChan*4 + 2] | (src[srcChan*4 + 3] << 8)}; sample = (sample^0x8000) - 32768; - index = clampi((index^0x8000) - 32768, 0, int{al::size(IMAStep_size)}-1); + index = clampi((index^0x8000) - 32768, 0, MaxStepIndex); if(skip == 0) { @@ -312,7 +313,7 @@ inline void LoadSamples(float *RESTRICT dstSamples, const al::byte *src sample = clampi(sample, -32768, 32767); index += IMA4Index_adjust[nibble]; - index = clampi(index, 0, int{al::size(IMAStep_size)}-1); + index = clampi(index, 0, MaxStepIndex); return sample; }; -- cgit v1.2.3