zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 99e83671d9719e209f817e8a942e4059efb31b09
parent 81f3d34a394dd56c22f71066501c3f6f4b4d86b7
Author: Hans Petter Selasky <hps@selasky.org>
Date:   Thu,  5 Sep 2019 20:18:30 +0200

Optimise away local integer variable.

Signed-off-by: Hans Petter Selasky <hps@selasky.org>

Diffstat:
Msrc/Containers/NotePool.cpp | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Containers/NotePool.cpp b/src/Containers/NotePool.cpp @@ -97,10 +97,12 @@ bool NotePool::NoteDescriptor::operator==(NoteDescriptor nd) static int getMergeableDescriptor(note_t note, uint8_t sendto, bool legato, NotePool::NoteDescriptor *ndesc) { - int desc_id = 0; - for(int i=0; i<POLYPHONY; ++i, ++desc_id) + int desc_id; + + for(desc_id = 0; desc_id != POLYPHONY; ++desc_id) { if(ndesc[desc_id].off()) break; + } if(desc_id != 0) { auto &nd = ndesc[desc_id-1]; @@ -110,7 +112,7 @@ static int getMergeableDescriptor(note_t note, uint8_t sendto, bool legato, } //Out of free descriptors - if(desc_id >= POLYPHONY || !ndesc[desc_id].off()) { + if(desc_id == POLYPHONY || !ndesc[desc_id].off()) { return -1; }