Improve performance by iterating from the tail when removing notes.

This commit is contained in:
Francois Best 2014-05-21 09:56:06 +02:00
parent 9157f847ca
commit db002130c9
1 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,7 @@ inline MidiNote::MidiNote(const MidiNote& inOther)
inline MidiNote& MidiNote::operator= (const MidiNote& inOther) inline MidiNote& MidiNote::operator= (const MidiNote& inOther)
{ {
pitch = inOther.pitch; pitch = inOther.pitch;
velocity = inOther.velocity; velocity = inOther.velocity;
return *this; return *this;
} }
@ -197,9 +197,9 @@ inline void MidiNoteList<Size>::add(const MidiNote& inNote)
template<byte Size> template<byte Size>
inline void MidiNoteList<Size>::remove(byte inPitch) inline void MidiNoteList<Size>::remove(byte inPitch)
{ {
if (mHead != 0) if (mTail != 0)
{ {
for (Cell* it = mHead; it != 0; it = it->next) for (Cell* it = mTail; it != 0; it = it->prev)
{ {
if (it->note.pitch == inPitch) if (it->note.pitch == inPitch)
{ {