aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-23 03:07:57 -0800
committerChris Robinson <[email protected]>2023-12-23 03:07:57 -0800
commit4720b2c64d91facea24e8411c104770bd3763afa (patch)
tree7ab1cc05e307be0b18ef6cc3cc8a84ece8dae624 /core
parentd7304c49a1d2cea2dae0ae38fdd9706dbcdb561f (diff)
Fix implicit widening after multiplication
Diffstat (limited to 'core')
-rw-r--r--core/converter.cpp14
-rw-r--r--core/hrtf.cpp2
-rw-r--r--core/mastering.h3
-rw-r--r--core/mixer/mixer_c.cpp6
-rw-r--r--core/mixer/mixer_neon.cpp6
-rw-r--r--core/mixer/mixer_sse.cpp6
-rw-r--r--core/voice.cpp10
7 files changed, 24 insertions, 23 deletions
diff --git a/core/converter.cpp b/core/converter.cpp
index b3ff5b0a..805b8548 100644
--- a/core/converter.cpp
+++ b/core/converter.cpp
@@ -213,8 +213,8 @@ uint SampleConverter::availableOut(uint srcframes) const
uint SampleConverter::convert(const void **src, uint *srcframes, void *dst, uint dstframes)
{
- const uint SrcFrameSize{static_cast<uint>(mChan.size()) * mSrcTypeSize};
- const uint DstFrameSize{static_cast<uint>(mChan.size()) * mDstTypeSize};
+ const size_t SrcFrameSize{mChan.size() * mSrcTypeSize};
+ const size_t DstFrameSize{mChan.size() * mDstTypeSize};
const uint increment{mIncrement};
auto SamplesIn = static_cast<const std::byte*>(*src);
uint NumSrcSamples{*srcframes};
@@ -325,9 +325,9 @@ uint SampleConverter::convertPlanar(const void **src, uint *srcframes, void *con
*/
for(size_t chan{0u};chan < mChan.size();chan++)
{
- LoadSamples(&mChan[chan].PrevSamples[prepcount],
- static_cast<const std::byte*>(src[chan]), 1, mSrcType, readable);
- src[chan] = static_cast<const std::byte*>(src[chan]) + mSrcTypeSize*readable;
+ auto *samples = static_cast<const std::byte*>(src[chan]);
+ LoadSamples(&mChan[chan].PrevSamples[prepcount], samples, 1, mSrcType, readable);
+ src[chan] = samples + size_t{mSrcTypeSize}*readable;
}
mSrcPrepCount = prepcount + readable;
@@ -374,7 +374,7 @@ uint SampleConverter::convertPlanar(const void **src, uint *srcframes, void *con
mResample(&mState, SrcData+MaxResamplerEdge, DataPosFrac, increment,
{DstData, DstSize});
- std::byte *DstSamples = static_cast<std::byte*>(dst[chan]) + pos*mDstTypeSize;
+ auto *DstSamples = static_cast<std::byte*>(dst[chan]) + pos*size_t{mDstTypeSize};
StoreSamples(DstSamples, DstData, 1, mDstType, DstSize);
}
@@ -387,7 +387,7 @@ uint SampleConverter::convertPlanar(const void **src, uint *srcframes, void *con
/* Update the src and dst pointers in case there's still more to do. */
const uint srcread{minu(NumSrcSamples, SrcDataEnd + mSrcPrepCount - prepcount)};
for(size_t chan{0u};chan < mChan.size();chan++)
- src[chan] = static_cast<const std::byte*>(src[chan]) + mSrcTypeSize*srcread;
+ src[chan] = static_cast<const std::byte*>(src[chan]) + size_t{mSrcTypeSize}*srcread;
NumSrcSamples -= srcread;
pos += DstSize;
diff --git a/core/hrtf.cpp b/core/hrtf.cpp
index a3faee49..8fc4030e 100644
--- a/core/hrtf.cpp
+++ b/core/hrtf.cpp
@@ -270,7 +270,7 @@ void HrtfStore::getCoeffs(float elevation, float azimuth, float distance, float
const float mult{blend[c]};
auto blend_coeffs = [mult](const float src, const float coeff) noexcept -> float
{ return src*mult + coeff; };
- std::transform(srccoeffs, srccoeffs + HrirLength*2, coeffout, coeffout, blend_coeffs);
+ std::transform(srccoeffs, srccoeffs + HrirLength*2_uz, coeffout, coeffout, blend_coeffs);
}
}
diff --git a/core/mastering.h b/core/mastering.h
index 08f3678e..8baea601 100644
--- a/core/mastering.h
+++ b/core/mastering.h
@@ -5,6 +5,7 @@
#include <memory>
#include "almalloc.h"
+#include "alnumeric.h"
#include "bufferline.h"
struct SlidingHold;
@@ -45,7 +46,7 @@ struct Compressor {
float mAttack{0.0f};
float mRelease{0.0f};
- alignas(16) std::array<float,2*BufferLineSize> mSideChain{};
+ alignas(16) std::array<float,BufferLineSize*2_uz> mSideChain{};
alignas(16) std::array<float,BufferLineSize> mCrestFactor{};
SlidingHold *mHold{nullptr};
diff --git a/core/mixer/mixer_c.cpp b/core/mixer/mixer_c.cpp
index 971297a4..93306bba 100644
--- a/core/mixer/mixer_c.cpp
+++ b/core/mixer/mixer_c.cpp
@@ -54,9 +54,9 @@ inline float do_bsinc(const BsincState &istate, const float *RESTRICT vals, cons
const uint pi{frac >> BsincPhaseDiffBits};
const float pf{static_cast<float>(frac&BsincPhaseDiffMask) * (1.0f/BsincPhaseDiffOne)};
- const float *RESTRICT fil{istate.filter + m*pi*2};
+ const float *RESTRICT fil{istate.filter + m*pi*2_uz};
const float *RESTRICT phd{fil + m};
- const float *RESTRICT scd{fil + BSincPhaseCount*2*m};
+ const float *RESTRICT scd{fil + BSincPhaseCount*2_uz*m};
const float *RESTRICT spd{scd + m};
/* Apply the scale and phase interpolated filter. */
@@ -74,7 +74,7 @@ inline float do_fastbsinc(const BsincState &istate, const float *RESTRICT vals,
const uint pi{frac >> BsincPhaseDiffBits};
const float pf{static_cast<float>(frac&BsincPhaseDiffMask) * (1.0f/BsincPhaseDiffOne)};
- const float *RESTRICT fil{istate.filter + m*pi*2};
+ const float *RESTRICT fil{istate.filter + m*pi*2_uz};
const float *RESTRICT phd{fil + m};
/* Apply the phase interpolated filter. */
diff --git a/core/mixer/mixer_neon.cpp b/core/mixer/mixer_neon.cpp
index 59369215..9fa2425f 100644
--- a/core/mixer/mixer_neon.cpp
+++ b/core/mixer/mixer_neon.cpp
@@ -244,9 +244,9 @@ void Resample_<BSincTag,NEONTag>(const InterpState *state, const float *RESTRICT
float32x4_t r4{vdupq_n_f32(0.0f)};
{
const float32x4_t pf4{vdupq_n_f32(pf)};
- const float *RESTRICT fil{filter + m*pi*2};
+ const float *RESTRICT fil{filter + m*pi*2_uz};
const float *RESTRICT phd{fil + m};
- const float *RESTRICT scd{fil + BSincPhaseCount*2*m};
+ const float *RESTRICT scd{fil + BSincPhaseCount*2_uz*m};
const float *RESTRICT spd{scd + m};
size_t td{m >> 2};
size_t j{0u};
@@ -291,7 +291,7 @@ void Resample_<FastBSincTag,NEONTag>(const InterpState *state, const float *REST
float32x4_t r4{vdupq_n_f32(0.0f)};
{
const float32x4_t pf4{vdupq_n_f32(pf)};
- const float *RESTRICT fil{filter + m*pi*2};
+ const float *RESTRICT fil{filter + m*pi*2_uz};
const float *RESTRICT phd{fil + m};
size_t td{m >> 2};
size_t j{0u};
diff --git a/core/mixer/mixer_sse.cpp b/core/mixer/mixer_sse.cpp
index 731ed884..809d585d 100644
--- a/core/mixer/mixer_sse.cpp
+++ b/core/mixer/mixer_sse.cpp
@@ -208,9 +208,9 @@ void Resample_<BSincTag,SSETag>(const InterpState *state, const float *RESTRICT
__m128 r4{_mm_setzero_ps()};
{
const __m128 pf4{_mm_set1_ps(pf)};
- const float *RESTRICT fil{filter + m*pi*2};
+ const float *RESTRICT fil{filter + m*pi*2_uz};
const float *RESTRICT phd{fil + m};
- const float *RESTRICT scd{fil + BSincPhaseCount*2*m};
+ const float *RESTRICT scd{fil + BSincPhaseCount*2_uz*m};
const float *RESTRICT spd{scd + m};
size_t td{m >> 2};
size_t j{0u};
@@ -256,7 +256,7 @@ void Resample_<FastBSincTag,SSETag>(const InterpState *state, const float *RESTR
__m128 r4{_mm_setzero_ps()};
{
const __m128 pf4{_mm_set1_ps(pf)};
- const float *RESTRICT fil{filter + m*pi*2};
+ const float *RESTRICT fil{filter + m*pi*2_uz};
const float *RESTRICT phd{fil + m};
size_t td{m >> 2};
size_t j{0u};
diff --git a/core/voice.cpp b/core/voice.cpp
index 1272b202..4a30ee83 100644
--- a/core/voice.cpp
+++ b/core/voice.cpp
@@ -904,8 +904,8 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
const size_t needBlocks{(needSamples + mSamplesPerBlock-1) / mSamplesPerBlock};
if(!mFlags.test(VoiceCallbackStopped) && needBlocks > mNumCallbackBlocks)
{
- const size_t byteOffset{mNumCallbackBlocks*mBytesPerBlock};
- const size_t needBytes{(needBlocks-mNumCallbackBlocks)*mBytesPerBlock};
+ const size_t byteOffset{mNumCallbackBlocks*size_t{mBytesPerBlock}};
+ const size_t needBytes{(needBlocks-mNumCallbackBlocks)*size_t{mBytesPerBlock}};
const int gotBytes{BufferListItem->mCallback(BufferListItem->mUserData,
&BufferListItem->mSamples[byteOffset], static_cast<int>(needBytes))};
@@ -919,7 +919,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
else
mNumCallbackBlocks = static_cast<uint>(needBlocks);
}
- const size_t numSamples{uint{mNumCallbackBlocks} * mSamplesPerBlock};
+ const size_t numSamples{size_t{mNumCallbackBlocks} * mSamplesPerBlock};
LoadBufferCallback(BufferListItem, bufferOffset, numSamples, mFmtType, chan,
mFrameStep, srcSampleDelay, srcBufferSize, al::to_address(resampleBuffer));
}
@@ -1099,8 +1099,8 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
const uint blocksDone{currentBlock - mCallbackBlockBase};
if(blocksDone < mNumCallbackBlocks)
{
- const size_t byteOffset{blocksDone*mBytesPerBlock};
- const size_t byteEnd{mNumCallbackBlocks*mBytesPerBlock};
+ const size_t byteOffset{blocksDone*size_t{mBytesPerBlock}};
+ const size_t byteEnd{mNumCallbackBlocks*size_t{mBytesPerBlock}};
std::byte *data{BufferListItem->mSamples};
std::copy(data+byteOffset, data+byteEnd, data);
mNumCallbackBlocks -= blocksDone;