Skip to content

Commit d99006e

Browse files
Dave-LowndesDavid Lowndes
andauthored
In process_block_until_close(), the equality checking was performed in 2 steps and as in all cases NDX was 1, analysers warned that the loop part was ineffective. (#7864)
To eliminate this warning, and simplify the code, just do a single loop from zero and also exit the loop when it fails the first test (should there ever be a use with NDX > 1). Also simplify to only have the single call to processSmoothing. Co-authored-by: David Lowndes <David@DAVIDPCZ>
1 parent 88f6939 commit d99006e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/common/ModulationSource.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -562,18 +562,15 @@ template <int NDX = 1> class ControllerModulationSourceVector : public Modulatio
562562
{
563563
assert(samplerate > 1000);
564564

565-
if (smoothingMode == Modulator::SmoothingMode::LEGACY)
566-
{
567-
processSmoothing(Modulator::SmoothingMode::SLOW_EXP, sigma);
568-
}
569-
else
570-
{
571-
processSmoothing(smoothingMode, sigma);
572-
}
565+
const auto sm = smoothingMode == Modulator::SmoothingMode::LEGACY
566+
? Modulator::SmoothingMode::SLOW_EXP
567+
: smoothingMode;
568+
569+
processSmoothing(sm, sigma);
573570

574-
auto res = (value[0] != target[0]);
571+
bool res = true;
575572

576-
for (int i = 1; i < NDX; ++i)
573+
for (int i = 0; (i < NDX) && res; ++i)
577574
{
578575
res &= (value[i] != target[i]);
579576
}

0 commit comments

Comments
 (0)