From 5983e820c4b9ecf863a93e4287442b8eb82d0b6d Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Fri, 27 Mar 2020 14:14:29 +0100 Subject: [PATCH] Bring back C++11 foreach loop in fmopl Upstream replaced C++11 code with C++ "almost-equivalents", when merging code from MAME project. Reverting this fixes few warnings (comparison of signed and unsigned integer in this case) and makes it slightly easier for the compiler to unroll the nested loops. --- src/hardware/mame/fmopl.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/hardware/mame/fmopl.cpp b/src/hardware/mame/fmopl.cpp index ac8e4cda..34b6bdce 100644 --- a/src/hardware/mame/fmopl.cpp +++ b/src/hardware/mame/fmopl.cpp @@ -1766,19 +1766,12 @@ void FM_OPL::ResetChip() for(int i = 0xff ; i >= 0x20 ; i--) WriteReg(i,0); /* reset operator parameters */ -// for(OPL_CH &CH : P_CH) - for(int ch = 0; ch < sizeof(P_CH)/ sizeof(P_CH[0]); ch++) - { - OPL_CH &CH = P_CH[ch]; -// for(OPL_SLOT &SLOT : CH.SLOT) - for(int slot = 0; slot < sizeof(CH.SLOT) / sizeof(CH.SLOT[0]); slot++) - { - - OPL_SLOT &SLOT = CH.SLOT[slot]; + for (OPL_CH &ch : P_CH) { + for (OPL_SLOT &slot : ch.SLOT) { /* wave table */ - SLOT.wavetable = 0; - SLOT.state = EG_OFF; - SLOT.volume = MAX_ATT_INDEX; + slot.wavetable = 0; + slot.state = EG_OFF; + slot.volume = MAX_ATT_INDEX; } } #if BUILD_Y8950