aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-04-27 01:16:09 -0700
committerChris Robinson <[email protected]>2023-04-27 01:16:09 -0700
commit7fc3a1012eedccc8ac125dc38f0c4e2f5af0458c (patch)
tree2b724a3097fc7016cbdd3d202b793cb569434bdb
parentdffbc171a5e3f549986696c9f86978fd57bc35cc (diff)
Use a static_cast for older versions of MSVC
-rw-r--r--core/voice.cpp5
1 files 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<FmtIMA4>(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<int>(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<FmtIMA4>(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<FmtIMA4>(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;
};