From 1b0ec08af5cd3b3268b5889ba4e30409431434e2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 4 Dec 2015 10:29:21 +0100 Subject: clang-modernize part 6 --- src/mame/audio/dave.cpp | 32 +++++++-------- src/mame/audio/exidy440.cpp | 8 ++-- src/mame/audio/flower.cpp | 4 +- src/mame/audio/lynx.cpp | 4 +- src/mame/audio/mea8000.cpp | 16 ++++---- src/mame/audio/turrett.cpp | 4 +- src/mame/drivers/atarist.cpp | 4 +- src/mame/drivers/bfm_sc45_helper.cpp | 60 ++++++++++++++--------------- src/mame/drivers/esq1.cpp | 4 +- src/mame/drivers/famibox.cpp | 12 +++--- src/mame/drivers/hyperscan.cpp | 16 ++++---- src/mame/drivers/iq151.cpp | 20 +++++----- src/mame/drivers/jack.cpp | 4 +- src/mame/drivers/joystand.cpp | 6 +-- src/mame/drivers/lethal.cpp | 4 +- src/mame/drivers/microvsn.cpp | 18 ++++----- src/mame/drivers/monty.cpp | 4 +- src/mame/drivers/mz3500.cpp | 6 +-- src/mame/drivers/nakajies.cpp | 4 +- src/mame/drivers/namcoic.cpp | 8 ++-- src/mame/drivers/namcos22.cpp | 4 +- src/mame/drivers/pcfx.cpp | 6 +-- src/mame/drivers/psikyo4.cpp | 4 +- src/mame/drivers/raiden2.cpp | 4 +- src/mame/drivers/segaxbd.cpp | 4 +- src/mame/drivers/stratos.cpp | 4 +- src/mame/drivers/subsino2.cpp | 4 +- src/mame/drivers/x07.cpp | 8 ++-- src/mame/includes/msx.h | 4 +- src/mame/includes/tandy2k.h | 4 +- src/mame/machine/315-5838_317-0229_comp.cpp | 20 +++++----- src/mame/machine/315_5296.cpp | 4 +- src/mame/machine/asic65.cpp | 4 +- src/mame/machine/balsente.cpp | 4 +- src/mame/machine/cdi070.cpp | 4 +- src/mame/machine/cdislave.cpp | 16 ++++---- src/mame/machine/decocass_tape.cpp | 4 +- src/mame/machine/fd1094.cpp | 8 ++-- src/mame/machine/gb.cpp | 4 +- src/mame/machine/kc.cpp | 16 ++++---- src/mame/machine/megacdcd.cpp | 8 ++-- src/mame/machine/micropolis.cpp | 14 +++---- src/mame/machine/model3.cpp | 8 ++-- src/mame/machine/msx.cpp | 18 ++++----- src/mame/machine/namcoio.cpp | 4 +- src/mame/machine/naomim1.cpp | 4 +- src/mame/machine/pce.cpp | 4 +- src/mame/machine/pgmprot_igs027a_type1.cpp | 4 +- src/mame/machine/pgmprot_igs027a_type3.cpp | 4 +- src/mame/machine/rx01.cpp | 8 ++-- src/mame/machine/segaic16.cpp | 12 +++--- src/mame/machine/snes.cpp | 20 +++++----- src/mame/machine/st0016.cpp | 4 +- src/mame/machine/tait8741.cpp | 14 +++---- src/mame/machine/taitoio.cpp | 12 +++--- src/mame/machine/vectrex.cpp | 4 +- src/mame/video/abc806.cpp | 4 +- src/mame/video/antic.cpp | 4 +- src/mame/video/bfm_dm01.cpp | 8 ++-- src/mame/video/chihiro.cpp | 12 +++--- src/mame/video/gauntlet.cpp | 4 +- src/mame/video/hng64.cpp | 8 ++-- src/mame/video/k053244_k053245.cpp | 4 +- src/mame/video/k053246_k053247_k055673.cpp | 8 ++-- src/mame/video/k057714.cpp | 8 ++-- src/mame/video/kaneko16.cpp | 4 +- src/mame/video/maria.cpp | 8 ++-- src/mame/video/mcd212.cpp | 60 ++++++++++++++--------------- src/mame/video/nemesis.cpp | 4 +- src/mame/video/pc080sn.cpp | 4 +- src/mame/video/powervr2.cpp | 6 +-- src/mame/video/ppu2c0x.cpp | 4 +- src/mame/video/psikyosh.cpp | 2 +- src/mame/video/rdptpipe.h | 4 +- src/mame/video/stic.cpp | 4 +- src/mame/video/tc0100scn.cpp | 4 +- src/mame/video/tc0360pri.cpp | 4 +- src/mame/video/tc0480scp.cpp | 4 +- 78 files changed, 341 insertions(+), 341 deletions(-) (limited to 'src/mame') diff --git a/src/mame/audio/dave.cpp b/src/mame/audio/dave.cpp index b3a2fd4b1f0..138b8d9ac40 100644 --- a/src/mame/audio/dave.cpp +++ b/src/mame/audio/dave.cpp @@ -95,23 +95,23 @@ void dave_device::device_start() save_item(NAME(m_level_and)); save_item(NAME(m_mame_volumes)); - for (int i = 0; i < ARRAY_LENGTH(m_period); i++) - m_period[i] = (STEP * machine().sample_rate()) / 125000; + for (auto & elem : m_period) + elem = (STEP * machine().sample_rate()) / 125000; - for (int i = 0; i < ARRAY_LENGTH(m_count); i++) - m_count[i] = (STEP * machine().sample_rate()) / 125000; + for (auto & elem : m_count) + elem = (STEP * machine().sample_rate()) / 125000; - for (int i = 0; i < ARRAY_LENGTH(m_level); i++) - m_level[i] = 0; + for (auto & elem : m_level) + elem = 0; - for (int i = 0; i < ARRAY_LENGTH(m_level_or); i++) - m_level_or[i] = 0; + for (auto & elem : m_level_or) + elem = 0; - for (int i = 0; i < ARRAY_LENGTH(m_level_and); i++) - m_level_and[i] = 0; + for (auto & elem : m_level_and) + elem = 0; - for (int i = 0; i < ARRAY_LENGTH(m_mame_volumes); i++) - m_mame_volumes[i] = 0; + for (auto & elem : m_mame_volumes) + elem = 0; /* dave has 3 tone channels and 1 noise channel. the volumes are mixed internally and output as left and right volume */ @@ -129,14 +129,14 @@ void dave_device::device_reset() { m_write_irq(CLEAR_LINE); - for (int i = 0; i < 4; i++) - m_segment[i] = 0; + for (auto & elem : m_segment) + elem = 0; m_irq_status = 0; m_irq_enable = 0; - for (int i = 0; i < 32; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } diff --git a/src/mame/audio/exidy440.cpp b/src/mame/audio/exidy440.cpp index 8ca9e5972e2..626bdc5ae9c 100644 --- a/src/mame/audio/exidy440.cpp +++ b/src/mame/audio/exidy440.cpp @@ -65,11 +65,11 @@ exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, cons { m_sound_banks[0] = m_sound_banks[1] = m_sound_banks[2] = m_sound_banks[3] = 0; - for (int i = 0; i < 4; i++) + for (auto & elem : m_sound_channel) { - m_sound_channel[i].base = nullptr; - m_sound_channel[i].offset = 0; - m_sound_channel[i].remaining = 0; + elem.base = nullptr; + elem.offset = 0; + elem.remaining = 0; } } diff --git a/src/mame/audio/flower.cpp b/src/mame/audio/flower.cpp index 785051faa64..fcde400310d 100644 --- a/src/mame/audio/flower.cpp +++ b/src/mame/audio/flower.cpp @@ -89,9 +89,9 @@ void flower_sound_device::device_reset() m_effect_timer->adjust(period, 0, period); /* reset all the voices */ - for (int i = 0; i < 8; i++) + for (auto & elem : m_channel_list) { - voice = &m_channel_list[i]; + voice = &elem; voice->freq = 0; voice->pos = 0; diff --git a/src/mame/audio/lynx.cpp b/src/mame/audio/lynx.cpp index 2e17abde91f..ba31b88ba06 100644 --- a/src/mame/audio/lynx.cpp +++ b/src/mame/audio/lynx.cpp @@ -212,9 +212,9 @@ void lynx2_sound_device::device_start() void lynx_sound_device::device_reset() { - for (int i = 0; i < LYNX_AUDIO_CHANNELS; i++) + for (auto & elem : m_audio) { - reset_channel(&m_audio[i]); + reset_channel(&elem); } } diff --git a/src/mame/audio/mea8000.cpp b/src/mame/audio/mea8000.cpp index 6936205b79f..306fec1ac3e 100644 --- a/src/mame/audio/mea8000.cpp +++ b/src/mame/audio/mea8000.cpp @@ -174,10 +174,10 @@ void mea8000_device::device_reset() m_roe = 0; m_state = MEA8000_STOPPED; update_req(); - for (int i = 0; i < 4; i++) + for (auto & elem : m_f) { - m_f[i].last_output = 0; - m_f[i].output = 0; + elem.last_output = 0; + elem.output = 0; } } @@ -215,8 +215,8 @@ void mea8000_device::init_tables() m_exp_table[i] = exp(-M_PI * f) * QUANT; m_exp2_table[i] = exp(-2 * M_PI * f) * QUANT; } - for (int i = 0; i < NOISE_LEN; i++) - m_noise_table[i] = (machine().rand() % (2 * QUANT)) - QUANT; + for (auto & elem : m_noise_table) + elem = (machine().rand() % (2 * QUANT)) - QUANT; } @@ -371,10 +371,10 @@ int mea8000_device::compute_sample() void mea8000_device::shift_frame() { m_last_pitch = m_pitch; - for (int i = 0; i < 4; i++) + for (auto & elem : m_f) { - m_f[i].last_bw = m_f[i].bw; - m_f[i].last_fm = m_f[i].fm; + elem.last_bw = elem.bw; + elem.last_fm = elem.fm; } m_last_ampl = m_ampl; } diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp index 69c8b784c3f..bb1fee907b4 100644 --- a/src/mame/audio/turrett.cpp +++ b/src/mame/audio/turrett.cpp @@ -69,8 +69,8 @@ void turrett_device::device_start() void turrett_device::device_reset() { - for (int ch = 0; ch < SOUND_CHANNELS; ++ch) - m_channels[ch].m_playing = false; + for (auto & elem : m_channels) + elem.m_playing = false; } diff --git a/src/mame/drivers/atarist.cpp b/src/mame/drivers/atarist.cpp index 46dcf99df03..053d68c4b61 100644 --- a/src/mame/drivers/atarist.cpp +++ b/src/mame/drivers/atarist.cpp @@ -760,9 +760,9 @@ void ste_state::dmasound_tick() { UINT8 *RAM = m_ram->pointer(); - for (int i = 0; i < 8; i++) + for (auto & elem : m_dmasnd_fifo) { - m_dmasnd_fifo[i] = RAM[m_dmasnd_cntr]; + elem = RAM[m_dmasnd_cntr]; m_dmasnd_cntr++; m_dmasnd_samples++; diff --git a/src/mame/drivers/bfm_sc45_helper.cpp b/src/mame/drivers/bfm_sc45_helper.cpp index 991f3894e59..264f9dbe71f 100644 --- a/src/mame/drivers/bfm_sc45_helper.cpp +++ b/src/mame/drivers/bfm_sc45_helper.cpp @@ -388,16 +388,16 @@ lampinfo lamps[16][16]; void set_clickable_temp(running_machine &machine, const std::string &teststring, int clickport, int clickmask) { - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { for (int x = 0; x < 16; x++) { - if (!strcmp(teststring.c_str(), lamps[y][x].lampname_alt.c_str())) + if (!strcmp(teststring.c_str(), lamp[x].lampname_alt.c_str())) { - lamps[y][x].clickport = clickport; - lamps[y][x].clickmask = clickmask; + lamp[x].clickport = clickport; + lamp[x].clickmask = clickmask; - lamps[y][x].lamptypename = "buttonlamp"; + lamp[x].lamptypename = "buttonlamp"; } } @@ -518,12 +518,12 @@ int find_lamp_strings(running_machine &machine) // layout elements for each of the text labels int d = 0; - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { //sc45helperlog("---ROW %02d---\n", y); for (int x = 0; x < 16; x++) { - sc45helperlog("\n", d, lamps[y][x].lampname.c_str()); + sc45helperlog("\n", d, lamp[x].lampname.c_str()); d++; } } @@ -589,17 +589,17 @@ int find_lamp_strings(running_machine &machine) // copy the button strings so we can modify some for easier comparisons d = 0; - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { for (int x = 0; x < 16; x++) { - lamps[y][x].lampname_alt = lamps[y][x].lampname; + lamp[x].lampname_alt = lamp[x].lampname; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "hold2/hi")) lamps[y][x].lampname_alt = "hold2"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "hold3/lo")) lamps[y][x].lampname_alt = "hold3"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "chg stake")) lamps[y][x].lampname_alt = "chnge stk"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "canc/coll")) lamps[y][x].lampname_alt = "cancel"; - if (!strcmp(lamps[y][x].lampname_alt.c_str(), "start")) lamps[y][x].lampname_alt = "strt exch"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "hold2/hi")) lamp[x].lampname_alt = "hold2"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "hold3/lo")) lamp[x].lampname_alt = "hold3"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "chg stake")) lamp[x].lampname_alt = "chnge stk"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "canc/coll")) lamp[x].lampname_alt = "cancel"; + if (!strcmp(lamp[x].lampname_alt.c_str(), "start")) lamp[x].lampname_alt = "strt exch"; } } @@ -623,20 +623,20 @@ int find_lamp_strings(running_machine &machine) if (pos == 2) sprintf(tempname2, "%sbot", tempname); - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { for (int x = 0; x < 16; x++) { - if (!strcmp(tempname2, lamps[y][x].lampname_alt.c_str())) + if (!strcmp(tempname2, lamp[x].lampname_alt.c_str())) { //sc45helperlog("%s found\n", tempname2); - lamps[y][x].draw_label = false; + lamp[x].draw_label = false; - lamps[y][x].x = 0 + (50 * reel); - lamps[y][x].y = 300 + (17 * pos); - lamps[y][x].width = 50; - lamps[y][x].height = 17; - lamps[y][x].lamptypename = "reellamp"; + lamp[x].x = 0 + (50 * reel); + lamp[x].y = 300 + (17 * pos); + lamp[x].width = 50; + lamp[x].height = 17; + lamp[x].lamptypename = "reellamp"; } @@ -676,17 +676,17 @@ int find_lamp_strings(running_machine &machine) // dump out basic matrix stuff in layout format d = 0; - for (int y = 0; y < 16; y++) + for (auto & lamp : lamps) { //sc45helperlog("---ROW %02d---\n", y); for (int x = 0; x < 16; x++) { - if (lamps[y][x].clickport== -1) sc45helperlog("\n", d, lamps[y][x].lamptypename.c_str(), lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); - else sc45helperlog("\n", d, lamps[y][x].lamptypename.c_str(), lamps[y][x].clickport, lamps[y][x].clickmask, lamps[y][x].x, lamps[y][x].y, lamps[y][x].width, lamps[y][x].height); + if (lamp[x].clickport== -1) sc45helperlog("\n", d, lamp[x].lamptypename.c_str(), lamp[x].x, lamp[x].y, lamp[x].width, lamp[x].height); + else sc45helperlog("\n", d, lamp[x].lamptypename.c_str(), lamp[x].clickport, lamp[x].clickmask, lamp[x].x, lamp[x].y, lamp[x].width, lamp[x].height); - if (lamps[y][x].draw_label == false) sc45helperlog("\n"); + if (lamp[x].draw_label == false) sc45helperlog("\n"); d++; } @@ -830,9 +830,9 @@ int find_reel_strings(running_machine &machine) int total_reel_symbols = 0; - for (unsigned int i = 0; i < reelsizes.size(); i++) + for (auto & reelsize : reelsizes) { - total_reel_symbols += reelsizes[i]; + total_reel_symbols += reelsize; } endblock = startblock + 4 * (total_reel_symbols); diff --git a/src/mame/drivers/esq1.cpp b/src/mame/drivers/esq1.cpp index b37f26185aa..4edb38303cf 100644 --- a/src/mame/drivers/esq1.cpp +++ b/src/mame/drivers/esq1.cpp @@ -332,8 +332,8 @@ void esq1_filters::device_start() { stream = stream_alloc(8, 2, 44100); memset(filters, 0, sizeof(filters)); - for(int i=0; i<8; i++) - recalc_filter(filters[i]); + for(auto & elem : filters) + recalc_filter(elem); } void esq1_filters::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) diff --git a/src/mame/drivers/famibox.cpp b/src/mame/drivers/famibox.cpp index 023cd64486b..6f93c9bb930 100644 --- a/src/mame/drivers/famibox.cpp +++ b/src/mame/drivers/famibox.cpp @@ -254,14 +254,14 @@ void famibox_state::famicombox_bankswitch(UINT8 bank) }; - for (int i = 0; i < ARRAY_LENGTH(famicombox_banks); i++ ) + for (auto & famicombox_bank : famicombox_banks) { - if ( bank == famicombox_banks[i].bank || - famicombox_banks[i].bank == 0 ) + if ( bank == famicombox_bank.bank || + famicombox_bank.bank == 0 ) { - membank("cpubank1")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank1_offset); - membank("cpubank2")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].bank2_offset); - membank("ppubank1")->set_base(memregion(famicombox_banks[i].memory_region)->base() + famicombox_banks[i].ppubank_offset); + membank("cpubank1")->set_base(memregion(famicombox_bank.memory_region)->base() + famicombox_bank.bank1_offset); + membank("cpubank2")->set_base(memregion(famicombox_bank.memory_region)->base() + famicombox_bank.bank2_offset); + membank("ppubank1")->set_base(memregion(famicombox_bank.memory_region)->base() + famicombox_bank.ppubank_offset); break; } } diff --git a/src/mame/drivers/hyperscan.cpp b/src/mame/drivers/hyperscan.cpp index baa1c767773..d5cc9d804e5 100644 --- a/src/mame/drivers/hyperscan.cpp +++ b/src/mame/drivers/hyperscan.cpp @@ -523,22 +523,22 @@ UINT32 hyperscan_state::spg290_screen_update(screen_device &screen, bitmap_rgb32 void hyperscan_state::spg290_timers_update() { - for(int i=0; i<6; i++) - if (m_timers[i].control & 0x80000000) + for(auto & elem : m_timers) + if (elem.control & 0x80000000) { - if (((m_timers[i].control2 >> 30) & 0x03) == 0x00) + if (((elem.control2 >> 30) & 0x03) == 0x00) { - if (m_timers[i].counter == 0xffff) + if (elem.counter == 0xffff) { - m_timers[i].counter = m_timers[i].preload; - if (m_timers[i].control & 0x08000000) + elem.counter = elem.preload; + if (elem.control & 0x08000000) { - m_timers[i].control |= 0x04000000; + elem.control |= 0x04000000; m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 56); } } else - m_timers[i].counter++; + elem.counter++; } else { diff --git a/src/mame/drivers/iq151.cpp b/src/mame/drivers/iq151.cpp index afee4573fcd..e4cbe4a504c 100644 --- a/src/mame/drivers/iq151.cpp +++ b/src/mame/drivers/iq151.cpp @@ -170,32 +170,32 @@ READ8_MEMBER(iq151_state::cartslot_r) { UINT8 data = 0xff; - for (int i=0; i<5; i++) - m_carts[i]->read(offset, data); + for (auto & elem : m_carts) + elem->read(offset, data); return data; } WRITE8_MEMBER(iq151_state::cartslot_w) { - for (int i=0; i<5; i++) - m_carts[i]->write(offset, data); + for (auto & elem : m_carts) + elem->write(offset, data); } READ8_MEMBER(iq151_state::cartslot_io_r) { UINT8 data = 0xff; - for (int i=0; i<5; i++) - m_carts[i]->io_read(offset, data); + for (auto & elem : m_carts) + elem->io_read(offset, data); return data; } WRITE8_MEMBER(iq151_state::cartslot_io_w) { - for (int i=0; i<5; i++) - m_carts[i]->io_write(offset, data); + for (auto & elem : m_carts) + elem->io_write(offset, data); } static ADDRESS_MAP_START(iq151_mem, AS_PROGRAM, 8, iq151_state) @@ -355,8 +355,8 @@ UINT32 iq151_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { bitmap.fill(0, cliprect); - for (int i=0; i<5; i++) - m_carts[i]->video_update(bitmap, cliprect); + for (auto & elem : m_carts) + elem->video_update(bitmap, cliprect); return 0; } diff --git a/src/mame/drivers/jack.cpp b/src/mame/drivers/jack.cpp index 01f1c88a2a7..952915820c1 100644 --- a/src/mame/drivers/jack.cpp +++ b/src/mame/drivers/jack.cpp @@ -878,8 +878,8 @@ MACHINE_RESET_MEMBER(jack_state,striv) m_question_address = 0; m_question_rom = 0; - for (int i = 0; i < 16; i++) - m_remap_address[i] = 0; + for (auto & elem : m_remap_address) + elem = 0; } diff --git a/src/mame/drivers/joystand.cpp b/src/mame/drivers/joystand.cpp index a9e4a9e097c..4a17628eae4 100644 --- a/src/mame/drivers/joystand.cpp +++ b/src/mame/drivers/joystand.cpp @@ -306,10 +306,10 @@ void joystand_state::video_start() m_bg1_tmap->set_transparent_pen(0xf); m_bg2_tmap->set_transparent_pen(0xf); - for (int i = 0; i < 2; ++i) + for (auto & elem : m_bg15_bitmap) { - m_bg15_bitmap[i].allocate(0x200, 0x200); - m_bg15_bitmap[i].fill(BG15_TRANSPARENT); + elem.allocate(0x200, 0x200); + elem.fill(BG15_TRANSPARENT); } bg15_tiles_dirty = true; diff --git a/src/mame/drivers/lethal.cpp b/src/mame/drivers/lethal.cpp index 59015da3704..30f82d8195c 100644 --- a/src/mame/drivers/lethal.cpp +++ b/src/mame/drivers/lethal.cpp @@ -481,8 +481,8 @@ void lethal_state::machine_start() void lethal_state::machine_reset() { - for (int i = 0; i < 4; i++) - m_layer_colorbase[i] = 0; + for (auto & elem : m_layer_colorbase) + elem = 0; m_sprite_colorbase = 0; m_back_colorbase = 0; diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index f82725bc43e..f15bfd8c0a6 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -163,16 +163,16 @@ MACHINE_START_MEMBER(microvision_state, microvision) MACHINE_RESET_MEMBER(microvision_state, microvision) { - for( int i = 0; i < 8; i++ ) + for(auto & elem : m_lcd_latch) { - m_lcd_latch[i] = 0; + elem = 0; } - for( int i = 0; i < 16; i++ ) + for(auto & elem : m_lcd) { for ( int j = 0; j < 16; j++ ) { - m_lcd[i][j] = 0; + elem[j] = 0; } } @@ -225,11 +225,11 @@ void microvision_state::update_lcd() { UINT16 temp = row; - for ( int j = 0; j < 16; j++ ) + for (auto & elem : m_lcd) { if ( ( temp & col ) & 0x8000 ) { - m_lcd[j][i] = 15; + elem[i] = 15; } temp <<= 1; } @@ -256,13 +256,13 @@ void microvision_state::screen_vblank(screen_device &screen, bool state) { if ( state ) { - for ( int i = 0; i < 16; i++ ) + for (auto & elem : m_lcd) { for ( int j= 0; j < 16; j++ ) { - if ( m_lcd[i][j] ) + if ( elem[j] ) { - m_lcd[i][j]--; + elem[j]--; } } } diff --git a/src/mame/drivers/monty.cpp b/src/mame/drivers/monty.cpp index 3ec54712777..0167938503b 100644 --- a/src/mame/drivers/monty.cpp +++ b/src/mame/drivers/monty.cpp @@ -44,8 +44,8 @@ public: , m_sed0(*this, "sed1520_0") , m_writeUpper(false) { - for (int i = 0; i < 42*32; i++) - m_pixels[i] = 0xff000000; + for (auto & elem : m_pixels) + elem = 0xff000000; } DECLARE_WRITE8_MEMBER(sound_w); diff --git a/src/mame/drivers/mz3500.cpp b/src/mame/drivers/mz3500.cpp index 8a5828e0401..9f480c08563 100644 --- a/src/mame/drivers/mz3500.cpp +++ b/src/mame/drivers/mz3500.cpp @@ -770,10 +770,10 @@ void mz3500_state::machine_reset() { m_fdd_sel = 0; { - for(int i=0;i<4;i++) + for(auto & elem : m_floppy_connector) { - m_floppy_connector[i]->get_device()->mon_w(ASSERT_LINE); - m_floppy_connector[i]->get_device()->set_rpm(300); + elem->get_device()->mon_w(ASSERT_LINE); + elem->get_device()->set_rpm(300); } machine().device("upd765a")->set_rate(250000); diff --git a/src/mame/drivers/nakajies.cpp b/src/mame/drivers/nakajies.cpp index 29b2ba35af8..bcf43ef4071 100644 --- a/src/mame/drivers/nakajies.cpp +++ b/src/mame/drivers/nakajies.cpp @@ -649,9 +649,9 @@ void nakajies_state::machine_reset() m_matrix = 0; /* Initialize banks */ - for ( int i = 0; i < 8; i++ ) + for (auto & elem : m_bank) { - m_bank[i] = 0; + elem = 0; } memset(m_ram_base, 0, m_ram_size); update_banks(); diff --git a/src/mame/drivers/namcoic.cpp b/src/mame/drivers/namcoic.cpp index 422756fb48f..1cc553b93eb 100644 --- a/src/mame/drivers/namcoic.cpp +++ b/src/mame/drivers/namcoic.cpp @@ -1165,8 +1165,8 @@ WRITE16_MEMBER( namcos2_shared_state::c169_roz_bank_w ) UINT16 old_data = m_c169_roz_bank[offset]; COMBINE_DATA(&m_c169_roz_bank[offset]); if (m_c169_roz_bank[offset] != old_data) - for (int i = 0; i < ROZ_TILEMAP_COUNT; i++) - m_c169_roz_tilemap[i]->mark_all_dirty(); + for (auto & elem : m_c169_roz_tilemap) + elem->mark_all_dirty(); } READ16_MEMBER( namcos2_shared_state::c169_roz_videoram_r ) @@ -1177,6 +1177,6 @@ READ16_MEMBER( namcos2_shared_state::c169_roz_videoram_r ) WRITE16_MEMBER( namcos2_shared_state::c169_roz_videoram_w ) { COMBINE_DATA(&m_c169_roz_videoram[offset]); - for (int i = 0; i < ROZ_TILEMAP_COUNT; i++) - m_c169_roz_tilemap[i]->mark_tile_dirty(offset); + for (auto & elem : m_c169_roz_tilemap) + elem->mark_tile_dirty(offset); } diff --git a/src/mame/drivers/namcos22.cpp b/src/mame/drivers/namcos22.cpp index cbc60e9fca9..64000211811 100644 --- a/src/mame/drivers/namcos22.cpp +++ b/src/mame/drivers/namcos22.cpp @@ -3874,8 +3874,8 @@ MACHINE_START_MEMBER(namcos22_state,adillor) { machine_start(); - for (int axis = 0; axis < 2; axis++) - m_ar_tb_interrupt[axis] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos22_state::adillor_trackball_interrupt),this)); + for (auto & elem : m_ar_tb_interrupt) + elem = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos22_state::adillor_trackball_interrupt),this)); } static MACHINE_CONFIG_DERIVED( adillor, namcos22s ) diff --git a/src/mame/drivers/pcfx.cpp b/src/mame/drivers/pcfx.cpp index d2faa292087..f80150959e6 100644 --- a/src/mame/drivers/pcfx.cpp +++ b/src/mame/drivers/pcfx.cpp @@ -380,13 +380,13 @@ inline void pcfx_state::check_irqs() UINT16 active_irqs = m_irq_pending & ~m_irq_mask; int highest_prio = -1; - for ( int i = 0; i < 8; i++ ) + for (auto & elem : m_irq_priority) { if ( active_irqs & 0x80 ) { - if ( m_irq_priority[i] >= highest_prio ) + if ( elem >= highest_prio ) { - highest_prio = m_irq_priority[i]; + highest_prio = elem; } } active_irqs <<= 1; diff --git a/src/mame/drivers/psikyo4.cpp b/src/mame/drivers/psikyo4.cpp index de33dbeb935..b1c04ab7ae8 100644 --- a/src/mame/drivers/psikyo4.cpp +++ b/src/mame/drivers/psikyo4.cpp @@ -296,13 +296,13 @@ WRITE32_MEMBER(psikyo4_state::io_select_w) { UINT32 bankdata = data >> 16; UINT32 bankmask = mem_mask >> 16; - for (int i = 0; i < 4; i++) + for (auto & elem : m_ymf_bank) { if (bankmask & 0x0f) { int banknum = bankdata & 0x0f; if (banknum < m_ymf_max_bank) - m_ymf_bank[i]->set_entry(banknum); + elem->set_entry(banknum); } bankdata >>= 4; bankmask >>= 4; diff --git a/src/mame/drivers/raiden2.cpp b/src/mame/drivers/raiden2.cpp index dce9db01f60..661f7fd9e27 100644 --- a/src/mame/drivers/raiden2.cpp +++ b/src/mame/drivers/raiden2.cpp @@ -2988,8 +2988,8 @@ const UINT16 raiden2_state::raiden_blended_colors[] = { void raiden2_state::init_blending(const UINT16 *table) { - for(int i=0; i<0x800; i++) - blend_active[i] = false; + for(auto & elem : blend_active) + elem = false; while(*table != 0xffff) blend_active[*table++] = true; } diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 8b26b9149b5..5758c0957c2 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -369,9 +369,9 @@ public: : segaxbd_new_state(mconfig, type, tag), m_subpcb(*this, "subpcb") { - for (int i = 0; i < 0x800; i++) + for (auto & elem : shareram) { - shareram[i] = 0x0000; + elem = 0x0000; } rampage1 = 0x0000; rampage2 = 0x0000; diff --git a/src/mame/drivers/stratos.cpp b/src/mame/drivers/stratos.cpp index 3af3d8ed6b8..733f62b979f 100644 --- a/src/mame/drivers/stratos.cpp +++ b/src/mame/drivers/stratos.cpp @@ -320,8 +320,8 @@ WRITE8_MEMBER(stratos_state::lcd_w) idx++; if(idx == 18*2) { logerror("lcd"); - for(int i=0; i<18; i++) - logerror(" %02x", vals[i]); + for(auto & val : vals) + logerror(" %02x", val); logerror("\n"); } } diff --git a/src/mame/drivers/subsino2.cpp b/src/mame/drivers/subsino2.cpp index a521bc00b92..fda484cd19e 100644 --- a/src/mame/drivers/subsino2.cpp +++ b/src/mame/drivers/subsino2.cpp @@ -712,9 +712,9 @@ UINT32 subsino2_state::screen_update_subsino2(screen_device &screen, bitmap_ind1 l->tmap->set_scroll_rows(1); l->tmap->set_scroll_cols(1); - for (int r = 0; r < 3; r++) + for (auto visible : m_ss9601_reelrects) { - rectangle visible = m_ss9601_reelrects[r]; + for (int x = 0; x < 0x40; x++) { diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index 08daaa4d696..4cb0db32f25 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -156,8 +156,8 @@ void x07_state::t6834_cmd (UINT8 cmd) case 0x0c: //ALM$ write { - for(int i = 0; i < 8; i++) - m_alarm[i] = m_in.data[m_in.read++]; + for(auto & elem : m_alarm) + elem = m_in.data[m_in.read++]; } break; @@ -500,8 +500,8 @@ void x07_state::t6834_cmd (UINT8 cmd) case 0x36: //alarm read { - for(int i = 0; i < 8; i++) - m_out.data[m_out.write++] = m_alarm[i]; + for(auto & elem : m_alarm) + m_out.data[m_out.write++] = elem; } break; diff --git a/src/mame/includes/msx.h b/src/mame/includes/msx.h index c52d8d7bef7..ba8e3e6064f 100644 --- a/src/mame/includes/msx.h +++ b/src/mame/includes/msx.h @@ -159,9 +159,9 @@ public: } m_mouse[0] = m_mouse[1] = 0; m_mouse_stat[0] = m_mouse_stat[1] = 0; - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + for (auto & elem : m_irq_state) { - m_irq_state[i] = CLEAR_LINE; + elem = CLEAR_LINE; } } diff --git a/src/mame/includes/tandy2k.h b/src/mame/includes/tandy2k.h index 761d2f0cb37..e9949ad3443 100644 --- a/src/mame/includes/tandy2k.h +++ b/src/mame/includes/tandy2k.h @@ -96,9 +96,9 @@ public: m_centronics_perror(0), m_centronics_busy(0) { - for (int i = 0; i < 4; i++) + for (auto & elem : m_busdmarq) { - m_busdmarq[i] = CLEAR_LINE; + elem = CLEAR_LINE; } } diff --git a/src/mame/machine/315-5838_317-0229_comp.cpp b/src/mame/machine/315-5838_317-0229_comp.cpp index d7c33c5afad..cfd38aa7c88 100644 --- a/src/mame/machine/315-5838_317-0229_comp.cpp +++ b/src/mame/machine/315-5838_317-0229_comp.cpp @@ -49,24 +49,24 @@ sega_315_5838_comp_device::sega_315_5838_comp_device(const machine_config &mconf void sega_315_5838_comp_device::device_start() { - for (int i = 0; i < 2; i++) + for (auto & elem : m_channel) { - m_channel[i].m_decathlt_lastcount = 0; - m_channel[i].m_decathlt_prot_uploadmode = 0; - m_channel[i].m_decathlt_prot_uploadoffset = 0; - m_channel[i].m_read_ch.bind_relative_to(*owner()); + elem.m_decathlt_lastcount = 0; + elem.m_decathlt_prot_uploadmode = 0; + elem.m_decathlt_prot_uploadoffset = 0; + elem.m_read_ch.bind_relative_to(*owner()); } } void sega_315_5838_comp_device::device_reset() { - for (int i = 0; i < 2; i++) + for (auto & elem : m_channel) { - m_channel[i].m_srcoffset = 0; - m_channel[i].m_decathlt_lastcount = 0; - m_channel[i].m_decathlt_prot_uploadmode = 0; - m_channel[i].m_decathlt_prot_uploadoffset = 0; + elem.m_srcoffset = 0; + elem.m_decathlt_lastcount = 0; + elem.m_decathlt_prot_uploadmode = 0; + elem.m_decathlt_prot_uploadoffset = 0; } m_protstate = 0; diff --git a/src/mame/machine/315_5296.cpp b/src/mame/machine/315_5296.cpp index 18551b95f23..34aa0da1d22 100644 --- a/src/mame/machine/315_5296.cpp +++ b/src/mame/machine/315_5296.cpp @@ -105,8 +105,8 @@ void sega_315_5296_device::device_reset() for (int i = 0; i < 8; i++) (*m_out_port_cb[i])((offs_t)i, 0); - for (int i = 0; i < 3; i++) - (*m_out_cnt_cb[i])(0); + for (auto & elem : m_out_cnt_cb) + (*elem)(0); } diff --git a/src/mame/machine/asic65.cpp b/src/mame/machine/asic65.cpp index 5674adfd49e..3ad34f5e32a 100644 --- a/src/mame/machine/asic65.cpp +++ b/src/mame/machine/asic65.cpp @@ -102,9 +102,9 @@ asic65_device::asic65_device(const machine_config &mconfig, const char *tag, dev m_tdata(0), m_log(nullptr) { - for (int i = 0; i < 32; i++) + for (auto & elem : m_param) { - m_param[i] = 0; + elem = 0; } } diff --git a/src/mame/machine/balsente.cpp b/src/mame/machine/balsente.cpp index d9bde8cb7ae..8eceeffa417 100644 --- a/src/mame/machine/balsente.cpp +++ b/src/mame/machine/balsente.cpp @@ -925,8 +925,8 @@ WRITE8_MEMBER(balsente_state::balsente_counter_control_w) /* bit D0 enables/disables audio */ if (diff_counter_control & 0x01) { - for (int ch = 0; ch < 6; ch++) - m_cem_device[ch]->set_output_gain(0, (data & 0x01) ? 1.0 : 0); + for (auto & elem : m_cem_device) + elem->set_output_gain(0, (data & 0x01) ? 1.0 : 0); } /* bit D1 is hooked to counter 0's gate */ diff --git a/src/mame/machine/cdi070.cpp b/src/mame/machine/cdi070.cpp index 36b41333b7d..cc8f377d76a 100644 --- a/src/mame/machine/cdi070.cpp +++ b/src/mame/machine/cdi070.cpp @@ -426,9 +426,9 @@ void cdi68070_device::mcu_frame() { quizard_calculate_state(); uart_rx(0x5a); - for(int index = 0; index < 8; index++) + for(auto & elem : m_state) { - uart_rx(m_state[index]); + uart_rx(elem); } } } diff --git a/src/mame/machine/cdislave.cpp b/src/mame/machine/cdislave.cpp index fea5c7ef2ac..ac9d4fe706f 100644 --- a/src/mame/machine/cdislave.cpp +++ b/src/mame/machine/cdislave.cpp @@ -484,15 +484,15 @@ void cdislave_device::device_start() void cdislave_device::device_reset() { - for(INT32 index = 0; index < 4; index++) + for(auto & elem : m_channel) { - m_channel[index].m_out_buf[0] = 0; - m_channel[index].m_out_buf[1] = 0; - m_channel[index].m_out_buf[2] = 0; - m_channel[index].m_out_buf[3] = 0; - m_channel[index].m_out_index = 0; - m_channel[index].m_out_count = 0; - m_channel[index].m_out_cmd = 0; + elem.m_out_buf[0] = 0; + elem.m_out_buf[1] = 0; + elem.m_out_buf[2] = 0; + elem.m_out_buf[3] = 0; + elem.m_out_index = 0; + elem.m_out_count = 0; + elem.m_out_cmd = 0; } memset(m_in_buf, 0, 17); diff --git a/src/mame/machine/decocass_tape.cpp b/src/mame/machine/decocass_tape.cpp index 48c9fd310ee..8b3f2785032 100644 --- a/src/mame/machine/decocass_tape.cpp +++ b/src/mame/machine/decocass_tape.cpp @@ -67,8 +67,8 @@ decocass_tape_device::decocass_tape_device(const machine_config &mconfig, const m_clockpos(0), m_numclocks(0) { - for (int i = 0; i < 256; i++) - m_crc16[i] = 0; + for (auto & elem : m_crc16) + elem = 0; } //------------------------------------------------- diff --git a/src/mame/machine/fd1094.cpp b/src/mame/machine/fd1094.cpp index 4d0992ef30e..6fb0f8b866e 100644 --- a/src/mame/machine/fd1094.cpp +++ b/src/mame/machine/fd1094.cpp @@ -500,8 +500,8 @@ fd1094_decryption_cache::fd1094_decryption_cache(fd1094_device &fd1094) void fd1094_decryption_cache::reset() { // reset all allocated cache buffers - for (int cache = 0; cache < 256; cache++) - m_decrypted_opcodes[cache].clear(); + for (auto & elem : m_decrypted_opcodes) + elem.clear(); } @@ -570,9 +570,9 @@ fd1094_device::fd1094_device(const machine_config &mconfig, const char *tag, dev // create the initial masked opcode table memset(m_masked_opcodes_lookup, 0, sizeof(m_masked_opcodes_lookup)); - for (int index = 0; index < ARRAY_LENGTH(s_masked_opcodes); index++) + for (auto opcode : s_masked_opcodes) { - UINT16 opcode = s_masked_opcodes[index]; + m_masked_opcodes_lookup[0][opcode >> 4] |= 1 << ((opcode >> 1) & 7); m_masked_opcodes_lookup[1][opcode >> 4] |= 1 << ((opcode >> 1) & 7); } diff --git a/src/mame/machine/gb.cpp b/src/mame/machine/gb.cpp index 187cea04d72..3b77d56b403 100644 --- a/src/mame/machine/gb.cpp +++ b/src/mame/machine/gb.cpp @@ -226,8 +226,8 @@ MACHINE_RESET_MEMBER(gb_state,gbc) /* Enable BIOS rom */ m_bios_disable = 0; - for (int i = 0; i < 8; i++) - memset(m_gbc_rammap[i], 0, 0x1000); + for (auto & elem : m_gbc_rammap) + memset(elem, 0, 0x1000); } MACHINE_RESET_MEMBER(gb_state,sgb) diff --git a/src/mame/machine/kc.cpp b/src/mame/machine/kc.cpp index 1f8c0d95ed2..d4374e31c45 100644 --- a/src/mame/machine/kc.cpp +++ b/src/mame/machine/kc.cpp @@ -84,8 +84,8 @@ READ8_MEMBER( kc_state::expansion_read ) // assert MEI line of first slot m_expansions[0]->mei_w(ASSERT_LINE); - for (int i=0; i<3; i++) - m_expansions[i]->read(offset, result); + for (auto & elem : m_expansions) + elem->read(offset, result); return result; } @@ -95,8 +95,8 @@ WRITE8_MEMBER( kc_state::expansion_write ) // assert MEI line of first slot m_expansions[0]->mei_w(ASSERT_LINE); - for (int i=0; i<3; i++) - m_expansions[i]->write(offset, data); + for (auto & elem : m_expansions) + elem->write(offset, data); } /* @@ -129,8 +129,8 @@ READ8_MEMBER( kc_state::expansion_io_read ) } else { - for (int i=0; i<3; i++) - m_expansions[i]->io_read(offset, result); + for (auto & elem : m_expansions) + elem->io_read(offset, result); } return result; @@ -152,8 +152,8 @@ WRITE8_MEMBER( kc_state::expansion_io_write ) } else { - for (int i=0; i<3; i++) - m_expansions[i]->io_write(offset, data); + for (auto & elem : m_expansions) + elem->io_write(offset, data); } } diff --git a/src/mame/machine/megacdcd.cpp b/src/mame/machine/megacdcd.cpp index 54c7d3c81a2..0fd65a3d2c0 100644 --- a/src/mame/machine/megacdcd.cpp +++ b/src/mame/machine/megacdcd.cpp @@ -23,10 +23,10 @@ lc89510_temp_device::lc89510_temp_device(const machine_config &mconfig, const ch is_neoCD = false; nff0002 = 0; - for (int i=0;i<10;i++) - CDD_TX[i] = 0; - for (int i=0;i<10;i++) - CDD_RX[i] = 0; + for (auto & elem : CDD_TX) + elem = 0; + for (auto & elem : CDD_RX) + elem = 0; NeoCDCommsWordCount = 0; NeoCD_StatusHack = 0; SCD_CURLBA = 0; diff --git a/src/mame/machine/micropolis.cpp b/src/mame/machine/micropolis.cpp index 9cf03159e18..a42c692718c 100644 --- a/src/mame/machine/micropolis.cpp +++ b/src/mame/machine/micropolis.cpp @@ -82,11 +82,11 @@ micropolis_device::micropolis_device(const machine_config &mconfig, const char * m_sector_length(0), m_drive(nullptr) { - for (int i = 0; i < 6144; i++) - m_buffer[i] = 0; + for (auto & elem : m_buffer) + elem = 0; - for (int i = 0; i < 4; i++) - m_floppy_drive_tags[i] = nullptr; + for (auto & elem : m_floppy_drive_tags) + elem = nullptr; } //------------------------------------------------- @@ -118,11 +118,11 @@ void micropolis_device::device_start() void micropolis_device::device_reset() { - for (int i = 0; i < 4; i++) + for (auto & elem : m_floppy_drive_tags) { - if (m_floppy_drive_tags[i]) + if (elem) { - legacy_floppy_image_device *img = siblingdevice(m_floppy_drive_tags[i]); + legacy_floppy_image_device *img = siblingdevice(elem); if (img) { diff --git a/src/mame/machine/model3.cpp b/src/mame/machine/model3.cpp index 12826528efe..1cfb25e48f8 100644 --- a/src/mame/machine/model3.cpp +++ b/src/mame/machine/model3.cpp @@ -154,9 +154,9 @@ void model3_state::tap_write(int tck, int tms, int tdi, int trst) if (m_ir == U64(0x000023fffffffffe)) { - for (int i=0; i < 32; i++) + for (auto & elem : m_id_data) { - m_id_data[i] = 0; + elem = 0; } m_id_size = 41; @@ -237,9 +237,9 @@ void model3_state::tap_set_asic_ids() * data on TAP reset and when the instruction is issued. */ - for (int i=0; i < 32; i++) + for (auto & elem : m_id_data) { - m_id_data[i] = 0; + elem = 0; } if (m_m3_step == 0x10) diff --git a/src/mame/machine/msx.cpp b/src/mame/machine/msx.cpp index 11402a50c40..b881ad38d4d 100644 --- a/src/mame/machine/msx.cpp +++ b/src/mame/machine/msx.cpp @@ -31,9 +31,9 @@ void msx_state::check_irq() { int state = CLEAR_LINE; - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + for (auto & elem : m_irq_state) { - if (m_irq_state[i] != CLEAR_LINE) + if (elem != CLEAR_LINE) { state = ASSERT_LINE; } @@ -47,9 +47,9 @@ void msx_state::machine_reset() { msx_memory_reset (); msx_memory_map_all (); - for (int i = 0; i < ARRAY_LENGTH(m_irq_state); i++) + for (auto & elem : m_irq_state) { - m_irq_state[i] = CLEAR_LINE; + elem = CLEAR_LINE; } check_irq(); } @@ -401,15 +401,15 @@ void msx_state::msx_memory_init() int count_populated_pages = 0; // Populate all unpopulated slots with the dummy interface - for ( int prim = 0; prim < 4; prim++ ) + for (auto & elem : m_all_slots) { for ( int sec = 0; sec < 4; sec++ ) { for ( int page = 0; page < 4; page++ ) { - if ( m_all_slots[prim][sec][page] == nullptr ) + if ( elem[sec][page] == nullptr ) { - m_all_slots[prim][sec][page] = &m_empty_slot; + elem[sec][page] = &m_empty_slot; } else { @@ -428,9 +428,9 @@ void msx_state::msx_memory_reset () { m_primary_slot = 0; - for (int prim=0; prim<4; prim++) + for (auto & elem : m_secondary_slot) { - m_secondary_slot[prim] = 0; + elem = 0; } } diff --git a/src/mame/machine/namcoio.cpp b/src/mame/machine/namcoio.cpp index b8fb22fef40..4ac534279ce 100644 --- a/src/mame/machine/namcoio.cpp +++ b/src/mame/machine/namcoio.cpp @@ -181,8 +181,8 @@ void namcoio_device::device_start() void namcoio_device::device_reset() { - for (int i = 0; i < 16; i++) - m_ram[i] = 0; + for (auto & elem : m_ram) + elem = 0; set_reset_line(PULSE_LINE); } diff --git a/src/mame/machine/naomim1.cpp b/src/mame/machine/naomim1.cpp index 5b16f278fb7..c9e5bc1c359 100644 --- a/src/mame/machine/naomim1.cpp +++ b/src/mame/machine/naomim1.cpp @@ -159,8 +159,8 @@ void naomi_m1_board::enc_reset() has_history = false; buffer_actual_size = 0; - for(int i=0; i<111; i++) - dict[i] = getb(8); + for(auto & elem : dict) + elem = getb(8); } void naomi_m1_board::wb(UINT8 byte) diff --git a/src/mame/machine/pce.cpp b/src/mame/machine/pce.cpp index 6aeba853933..ad5d712367c 100644 --- a/src/mame/machine/pce.cpp +++ b/src/mame/machine/pce.cpp @@ -110,8 +110,8 @@ MACHINE_START_MEMBER(pce_state,pce) MACHINE_RESET_MEMBER(pce_state,mess_pce) { - for (int joy_i = 0; joy_i < 5; joy_i++) - m_joy_6b_packet[joy_i] = 0; + for (auto & elem : m_joy_6b_packet) + elem = 0; /* Note: Arcade Card BIOS contents are the same as System 3, only internal HW differs. We use a category to select between modes (some games can be run in either S-CD or A-CD modes) */ diff --git a/src/mame/machine/pgmprot_igs027a_type1.cpp b/src/mame/machine/pgmprot_igs027a_type1.cpp index 096d1135c2b..84b7bfc5de6 100644 --- a/src/mame/machine/pgmprot_igs027a_type1.cpp +++ b/src/mame/machine/pgmprot_igs027a_type1.cpp @@ -881,9 +881,9 @@ void pgm_arm_type1_state::command_handler_puzzli2(int pc) m_valueresponse = 0x36<<16; // clear the return structure - for (int columns=0;columns<8;columns++) + for (auto & elem : level_structure) for (int rows=0;rows<10;rows++) - level_structure[columns][rows] = 0x0000; + elem[rows] = 0x0000; break; diff --git a/src/mame/machine/pgmprot_igs027a_type3.cpp b/src/mame/machine/pgmprot_igs027a_type3.cpp index 8faa5fc4432..24fc0c19ccd 100644 --- a/src/mame/machine/pgmprot_igs027a_type3.cpp +++ b/src/mame/machine/pgmprot_igs027a_type3.cpp @@ -566,10 +566,10 @@ void pgm_arm_type3_state::pgm_patch_external_arm_rom_jumptable_theglada(int base */ - for (int i = 0; i < 131; i++) + for (auto & subroutine_addresse : subroutine_addresses) { // UINT32 addr = extprot[(base/2)] | (extprot[(base/2) + 1] << 16); - extprot[(base / 2)] = subroutine_addresses[i]; + extprot[(base / 2)] = subroutine_addresse; base += 4; // printf("%04x (%08x)\n", subroutine_addresses[i], addr ); diff --git a/src/mame/machine/rx01.cpp b/src/mame/machine/rx01.cpp index c1889eb6a8b..b4cb85869ea 100644 --- a/src/mame/machine/rx01.cpp +++ b/src/mame/machine/rx01.cpp @@ -80,11 +80,11 @@ void rx01_device::device_start() void rx01_device::device_reset() { - for(int i=0;i<2;i++) + for(auto & elem : m_image) { - m_image[i]->floppy_mon_w(0); // turn it on - m_image[i]->floppy_drive_set_controller(this); - m_image[i]->floppy_drive_set_rpm(360.); + elem->floppy_mon_w(0); // turn it on + elem->floppy_drive_set_controller(this); + elem->floppy_drive_set_rpm(360.); } m_rxes = 0; m_rxcs = 0; diff --git a/src/mame/machine/segaic16.cpp b/src/mame/machine/segaic16.cpp index ee171e9af70..3d807412a56 100644 --- a/src/mame/machine/segaic16.cpp +++ b/src/mame/machine/segaic16.cpp @@ -487,8 +487,8 @@ void sega_315_5195_mapper_device::configure_explicit(const UINT8 *map_data) void sega_315_5195_mapper_device::fd1094_state_change(UINT8 state) { // iterate over regions and set the decrypted address of any ROM banks - for (int index = 0; index < ARRAY_LENGTH(m_banks); index++) - m_banks[index].update(); + for (auto & elem : m_banks) + elem.update(); } @@ -511,16 +511,16 @@ void sega_315_5195_mapper_device::device_start() // if we are mapping an FD1089, tell all the banks fd1089_base_device *fd1089 = dynamic_cast(m_cpu); if (fd1089 != nullptr) - for (int banknum = 0; banknum < ARRAY_LENGTH(m_banks); banknum++) - m_banks[banknum].set_decrypt(fd1089); + for (auto & elem : m_banks) + elem.set_decrypt(fd1089); // if we are mapping an FD1094, register for state change notifications and tell all the banks fd1094_device *fd1094 = dynamic_cast(m_cpu); if (fd1094 != nullptr) { fd1094->notify_state_change(fd1094_device::state_change_delegate(FUNC(sega_315_5195_mapper_device::fd1094_state_change), this)); - for (int banknum = 0; banknum < ARRAY_LENGTH(m_banks); banknum++) - m_banks[banknum].set_decrypt(fd1094); + for (auto & elem : m_banks) + elem.set_decrypt(fd1094); } // find the address space that is to be mapped diff --git a/src/mame/machine/snes.cpp b/src/mame/machine/snes.cpp index 30b125f94fa..9c4253906e2 100644 --- a/src/mame/machine/snes.cpp +++ b/src/mame/machine/snes.cpp @@ -1123,17 +1123,17 @@ void snes_state::machine_reset() snes_init_ram(); /* init DMA regs to be 0xff */ - for (int i = 0; i < 8; i++) + for (auto & elem : m_dma_channel) { - m_dma_channel[i].dmap = 0xff; - m_dma_channel[i].dest_addr = 0xff; - m_dma_channel[i].src_addr = 0xffff; - m_dma_channel[i].bank = 0xff; - m_dma_channel[i].trans_size = 0xffff; - m_dma_channel[i].ibank = 0xff; - m_dma_channel[i].hdma_addr = 0xffff; - m_dma_channel[i].hdma_line_counter = 0xff; - m_dma_channel[i].unk = 0xff; + elem.dmap = 0xff; + elem.dest_addr = 0xff; + elem.src_addr = 0xffff; + elem.bank = 0xff; + elem.trans_size = 0xffff; + elem.ibank = 0xff; + elem.hdma_addr = 0xffff; + elem.hdma_line_counter = 0xff; + elem.unk = 0xff; } /* Set STAT78 to NTSC or PAL */ diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp index 3abdc4eafaf..08959876e99 100644 --- a/src/mame/machine/st0016.cpp +++ b/src/mame/machine/st0016.cpp @@ -49,8 +49,8 @@ st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char * m_palette(*this, "palette") { - for (int i = 0; i < 0xc0; i++) - st0016_vregs[i] = 0; + for (auto & elem : st0016_vregs) + elem = 0; } diff --git a/src/mame/machine/tait8741.cpp b/src/mame/machine/tait8741.cpp index 58df20ca4ed..5e568fbd6f1 100644 --- a/src/mame/machine/tait8741.cpp +++ b/src/mame/machine/tait8741.cpp @@ -381,15 +381,15 @@ void josvolly8741_4pack_device::device_reset() { m_nmi_enable = 0; - for(int i=0;i<4;i++) + for(auto & elem : m_i8741) { - m_i8741[i].cmd = 0; - m_i8741[i].sts = 0; // 0xf0; /* init flag */ - m_i8741[i].txd = 0; - m_i8741[i].outport = 0xff; - m_i8741[i].rxd = 0; + elem.cmd = 0; + elem.sts = 0; // 0xf0; /* init flag */ + elem.txd = 0; + elem.outport = 0xff; + elem.rxd = 0; - m_i8741[i].rst = 1; + elem.rst = 1; } } diff --git a/src/mame/machine/taitoio.cpp b/src/mame/machine/taitoio.cpp index 4b15fa06932..6d2bcadd9b0 100644 --- a/src/mame/machine/taitoio.cpp +++ b/src/mame/machine/taitoio.cpp @@ -90,8 +90,8 @@ void tc0220ioc_device::device_reset() { m_port = 0; - for (int i = 0; i < 8; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } /***************************************************************************** @@ -213,8 +213,8 @@ void tc0510nio_device::device_start() void tc0510nio_device::device_reset() { - for (int i = 0; i < 8; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } /***************************************************************************** @@ -340,8 +340,8 @@ void tc0640fio_device::device_start() void tc0640fio_device::device_reset() { - for (int i = 0; i < 8; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } diff --git a/src/mame/machine/vectrex.cpp b/src/mame/machine/vectrex.cpp index ca64a1cd23c..4959c3de5f1 100644 --- a/src/mame/machine/vectrex.cpp +++ b/src/mame/machine/vectrex.cpp @@ -306,8 +306,8 @@ DRIVER_INIT_MEMBER(vectrex_state,vectrex) { m_imager_angles = unknown_game_angles; m_beam_color = rgb_t::white; - for (int i = 0; i < ARRAY_LENGTH(m_imager_colors); i++) - m_imager_colors[i] = rgb_t::white; + for (auto & elem : m_imager_colors) + elem = rgb_t::white; /* * Minestorm's PRNG doesn't work with a 0 seed (mines in the first diff --git a/src/mame/video/abc806.cpp b/src/mame/video/abc806.cpp index f958b025b1c..4e8ff8ba854 100644 --- a/src/mame/video/abc806.cpp +++ b/src/mame/video/abc806.cpp @@ -413,9 +413,9 @@ void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) void abc806_state::video_start() { // initialize variables - for (int i = 0; i < 16; i++) + for (auto & elem : m_hrc) { - m_hrc[i] = 0; + elem = 0; } m_sync = 10; diff --git a/src/mame/video/antic.cpp b/src/mame/video/antic.cpp index 1a8979abf6a..b01b7ba259e 100644 --- a/src/mame/video/antic.cpp +++ b/src/mame/video/antic.cpp @@ -96,8 +96,8 @@ void antic_device::device_start() LOG(("atari cclk_init\n")); cclk_init(); - for (int i = 0; i < 64; i++) - m_prio_table[i] = auto_alloc_array_clear(machine(), UINT8, 8*256); + for (auto & elem : m_prio_table) + elem = auto_alloc_array_clear(machine(), UINT8, 8*256); LOG(("atari prio_init\n")); prio_init(); diff --git a/src/mame/video/bfm_dm01.cpp b/src/mame/video/bfm_dm01.cpp index 4c9f8e31825..19911ee5654 100644 --- a/src/mame/video/bfm_dm01.cpp +++ b/src/mame/video/bfm_dm01.cpp @@ -62,11 +62,11 @@ bfmdm01_device::bfmdm01_device(const machine_config &mconfig, const char *tag, d m_comdata(0), m_busy_cb(*this) { - for (int i = 0; i < 65; i++) - m_segbuffer[i] = 0; + for (auto & elem : m_segbuffer) + elem = 0; - for (int i = 0; i < DM_BYTESPERROW; i++) - m_scanline[i] = 0; + for (auto & elem : m_scanline) + elem = 0; } //------------------------------------------------- diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index 5aa59cf0493..8e59ed253a9 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -433,8 +433,8 @@ int vertex_program_disassembler::disassemble(unsigned int *instruction, char *li vertex_program_simulator::vertex_program_simulator() { - for (int i = 0; i < 256; i++) - op[i].modified = 0; + for (auto & elem : op) + elem.modified = 0; initialize_constants(); } @@ -674,17 +674,17 @@ void vertex_program_simulator::initialize_outputs() void vertex_program_simulator::initialize_temps() { - for (int n = 0; n < 32; n++) { + for (auto & elem : r_temp) { for (int m = 0; m < 4; m++) - r_temp[n].fv[m] = 0; + elem.fv[m] = 0; } } void vertex_program_simulator::initialize_constants() { - for (int n = 0; n < 192; n++) { + for (auto & elem : c_constant) { for (int m = 0; m < 4;m++) - c_constant[n].fv[m] = 0; + elem.fv[m] = 0; } } diff --git a/src/mame/video/gauntlet.cpp b/src/mame/video/gauntlet.cpp index 0d7120a627b..c9430f4f0ef 100644 --- a/src/mame/video/gauntlet.cpp +++ b/src/mame/video/gauntlet.cpp @@ -83,8 +83,8 @@ VIDEO_START_MEMBER(gauntlet_state,gauntlet) { /* modify the motion object code lookup table to account for the code XOR */ std::vector &codelookup = m_mob->code_lookup(); - for (unsigned int i = 0; i < codelookup.size(); i++) - codelookup[i] ^= 0x800; + for (auto & elem : codelookup) + elem ^= 0x800; /* set up the base color for the playfield */ m_playfield_color_bank = m_vindctr2_screen_refresh ? 0 : 1; diff --git a/src/mame/video/hng64.cpp b/src/mame/video/hng64.cpp index 01a5709085c..ac7084687b6 100644 --- a/src/mame/video/hng64.cpp +++ b/src/mame/video/hng64.cpp @@ -1274,11 +1274,11 @@ void hng64_state::video_start() m_tilemap[3].m_tilemap_16x16 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(hng64_state::get_hng64_tile3_16x16_info),this), TILEMAP_SCAN_ROWS, 16, 16, 128, 128); /* 128x128x4 = 0x10000 */ m_tilemap[3].m_tilemap_16x16_alt = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(hng64_state::get_hng64_tile3_16x16_info),this), TILEMAP_SCAN_ROWS, 16, 16, 256, 64); /* 128x128x4 = 0x10000 */ - for (int i = 0; i < 4; i++) + for (auto & elem : m_tilemap) { - m_tilemap[i].m_tilemap_8x8->set_transparent_pen(0); - m_tilemap[i].m_tilemap_16x16->set_transparent_pen(0); - m_tilemap[i].m_tilemap_16x16_alt->set_transparent_pen(0); + elem.m_tilemap_8x8->set_transparent_pen(0); + elem.m_tilemap_16x16->set_transparent_pen(0); + elem.m_tilemap_16x16_alt->set_transparent_pen(0); } // Debug switch, turn on / off additive blending on a per-tilemap basis diff --git a/src/mame/video/k053244_k053245.cpp b/src/mame/video/k053244_k053245.cpp index 23227fede07..8596af1ce54 100644 --- a/src/mame/video/k053244_k053245.cpp +++ b/src/mame/video/k053244_k053245.cpp @@ -152,8 +152,8 @@ void k05324x_device::device_reset() { m_rombank = 0; - for (int i = 0; i < 0x10; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } /***************************************************************************** diff --git a/src/mame/video/k053246_k053247_k055673.cpp b/src/mame/video/k053246_k053247_k055673.cpp index 27636d19001..b97fc461e63 100644 --- a/src/mame/video/k053246_k053247_k055673.cpp +++ b/src/mame/video/k053246_k053247_k055673.cpp @@ -52,11 +52,11 @@ void k053247_device::clear_all() m_ram = nullptr; m_gfx = nullptr; - for (int i=0;i<8;i++) - m_kx46_regs[i] = 0; + for (auto & elem : m_kx46_regs) + elem = 0; - for (int i=0;i<16;i++) - m_kx47_regs[i] = 0; + for (auto & elem : m_kx47_regs) + elem = 0; m_objcha_line = 0; m_z_rejection = 0; diff --git a/src/mame/video/k057714.cpp b/src/mame/video/k057714.cpp index 2ab8685cf56..405f0e722c2 100644 --- a/src/mame/video/k057714.cpp +++ b/src/mame/video/k057714.cpp @@ -35,11 +35,11 @@ void k057714_device::device_reset() m_vram_fifo0_addr = 0; m_vram_fifo1_addr = 0; - for (int i=0; i < 4; i++) + for (auto & elem : m_frame) { - m_frame[i].base = 0; - m_frame[i].width = 0; - m_frame[i].height = 0; + elem.base = 0; + elem.width = 0; + elem.height = 0; } } diff --git a/src/mame/video/kaneko16.cpp b/src/mame/video/kaneko16.cpp index 18d1e602511..47dc6e209d9 100644 --- a/src/mame/video/kaneko16.cpp +++ b/src/mame/video/kaneko16.cpp @@ -116,8 +116,8 @@ VIDEO_START_MEMBER(kaneko16_berlwall_state,berlwall) /* Render the hi-color static backgrounds held in the ROMs */ - for (int screen = 0; screen < 32; screen++) - m_bg15_bitmap[screen].allocate(256, 256); + for (auto & elem : m_bg15_bitmap) + elem.allocate(256, 256); /* 8aba is used as background color diff --git a/src/mame/video/maria.cpp b/src/mame/video/maria.cpp index b2514770e82..a5501989e4b 100644 --- a/src/mame/video/maria.cpp +++ b/src/mame/video/maria.cpp @@ -93,12 +93,12 @@ void atari_maria_device::device_start() void atari_maria_device::device_reset() { - for (int i = 0; i < 32; i++) - m_maria_palette[i] = 0; + for (auto & elem : m_maria_palette) + elem = 0; - for (int i = 0; i < 2; i++) + for (auto & elem : m_line_ram) for (int j = 0; j < 160; j++) - m_line_ram[i][j] = 0; + elem[j] = 0; m_active_buffer = 0; diff --git a/src/mame/video/mcd212.cpp b/src/mame/video/mcd212.cpp index 5476e0a5030..aec55056c8f 100644 --- a/src/mame/video/mcd212.cpp +++ b/src/mame/video/mcd212.cpp @@ -1470,37 +1470,37 @@ TIMER_CALLBACK_MEMBER( mcd212_device::perform_scan ) void mcd212_device::device_reset() { - for(int index = 0; index < 2; index++) + for(auto & elem : m_channel) { - m_channel[index].csrr = 0; - m_channel[index].csrw = 0; - m_channel[index].dcr = 0; - m_channel[index].vsr = 0; - m_channel[index].ddr = 0; - m_channel[index].dcp = 0; - m_channel[index].dca = 0; - memset(m_channel[index].clut_r, 0, 256); - memset(m_channel[index].clut_g, 0, 256); - memset(m_channel[index].clut_b, 0, 256); - m_channel[index].image_coding_method = 0; - m_channel[index].transparency_control = 0; - m_channel[index].plane_order = 0; - m_channel[index].clut_bank = 0; - m_channel[index].transparent_color_a = 0; - m_channel[index].transparent_color_b = 0; - m_channel[index].mask_color_a = 0; - m_channel[index].mask_color_b = 0; - m_channel[index].dyuv_abs_start_a = 0; - m_channel[index].dyuv_abs_start_b = 0; - m_channel[index].cursor_position = 0; - m_channel[index].cursor_control = 0; - memset((UINT8*)&m_channel[index].cursor_pattern, 0, 16 * sizeof(UINT32)); - memset((UINT8*)&m_channel[index].region_control, 0, 8 * sizeof(UINT32)); - m_channel[index].backdrop_color = 0; - m_channel[index].mosaic_hold_a = 0; - m_channel[index].mosaic_hold_b = 0; - memset(m_channel[index].weight_factor_a, 0, 768); - memset(m_channel[index].weight_factor_b, 0, 768); + elem.csrr = 0; + elem.csrw = 0; + elem.dcr = 0; + elem.vsr = 0; + elem.ddr = 0; + elem.dcp = 0; + elem.dca = 0; + memset(elem.clut_r, 0, 256); + memset(elem.clut_g, 0, 256); + memset(elem.clut_b, 0, 256); + elem.image_coding_method = 0; + elem.transparency_control = 0; + elem.plane_order = 0; + elem.clut_bank = 0; + elem.transparent_color_a = 0; + elem.transparent_color_b = 0; + elem.mask_color_a = 0; + elem.mask_color_b = 0; + elem.dyuv_abs_start_a = 0; + elem.dyuv_abs_start_b = 0; + elem.cursor_position = 0; + elem.cursor_control = 0; + memset((UINT8*)&elem.cursor_pattern, 0, 16 * sizeof(UINT32)); + memset((UINT8*)&elem.region_control, 0, 8 * sizeof(UINT32)); + elem.backdrop_color = 0; + elem.mosaic_hold_a = 0; + elem.mosaic_hold_b = 0; + memset(elem.weight_factor_a, 0, 768); + memset(elem.weight_factor_b, 0, 768); } memset(m_region_flag_0, 0, 768); memset(m_region_flag_1, 0, 768); diff --git a/src/mame/video/nemesis.cpp b/src/mame/video/nemesis.cpp index f5b15c30794..191f5e20d59 100644 --- a/src/mame/video/nemesis.cpp +++ b/src/mame/video/nemesis.cpp @@ -188,8 +188,8 @@ void nemesis_state::create_palette_lookups() // normalize black/white levels double black = m_palette_lookup[0]; double white = 255.0 / (m_palette_lookup[31] - black); - for (int i = 0; i < 32; i++) - m_palette_lookup[i] = (m_palette_lookup[i] - black) * white + 0.5; + for (auto & elem : m_palette_lookup) + elem = (elem - black) * white + 0.5; } diff --git a/src/mame/video/pc080sn.cpp b/src/mame/video/pc080sn.cpp index 449cd97351a..55c67ed2bfa 100644 --- a/src/mame/video/pc080sn.cpp +++ b/src/mame/video/pc080sn.cpp @@ -61,8 +61,8 @@ pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, d m_gfxdecode(*this), m_palette(*this) { - for (int i = 0; i < 8; i++) - m_ctrl[i] = 0; + for (auto & elem : m_ctrl) + elem = 0; for (int i = 0; i < 2; i++) { diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp index bea1e3fca36..a0db91d6b62 100644 --- a/src/mame/video/powervr2.cpp +++ b/src/mame/video/powervr2.cpp @@ -921,9 +921,9 @@ WRITE32_MEMBER( powervr2_device::softreset_w ) logerror("%s: Core Pipeline soft reset\n", tag()); #endif if (start_render_received == 1) { - for (int a=0;a < NUM_BUFFERS;a++) - if (grab[a].busy == 1) - grab[a].busy = 0; + for (auto & elem : grab) + if (elem.busy == 1) + elem.busy = 0; start_render_received = 0; } } diff --git a/src/mame/video/ppu2c0x.cpp b/src/mame/video/ppu2c0x.cpp index 17f17178d75..d6511dbb245 100644 --- a/src/mame/video/ppu2c0x.cpp +++ b/src/mame/video/ppu2c0x.cpp @@ -144,8 +144,8 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, m_draw_phase(0), m_use_sprite_write_limitation(true) { - for (int i = 0; i < PPU_MAX_REG; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; memset(m_palette_ram, 0, ARRAY_LENGTH(m_palette_ram)); diff --git a/src/mame/video/psikyosh.cpp b/src/mame/video/psikyosh.cpp index 0eb703853cd..24b51d9e375 100644 --- a/src/mame/video/psikyosh.cpp +++ b/src/mame/video/psikyosh.cpp @@ -260,7 +260,7 @@ void psikyosh_state::draw_bglayerscroll( int layer, bitmap_rgb32 &bitmap, const /* cache rendered bitmap */ int last_bank[32]; // corresponds to bank of bitmap in m_bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each - for(int ii = 0; ii < 32; ii++) last_bank[ii] = -1; + for(auto & elem : last_bank) elem = -1; int scr_width = cliprect.width(); int scr_height = cliprect.height(); diff --git a/src/mame/video/rdptpipe.h b/src/mame/video/rdptpipe.h index e47f6f17130..201b15d63c1 100644 --- a/src/mame/video/rdptpipe.h +++ b/src/mame/video/rdptpipe.h @@ -34,9 +34,9 @@ class n64_texture_pipe_t } m_start_span = false; - for (int idx = 0; idx < 80; idx++) + for (auto & elem : m_texel_fetch) { - m_texel_fetch[idx] = &n64_texture_pipe_t::fetch_nop; + elem = &n64_texture_pipe_t::fetch_nop; } m_texel_fetch[ 8] = &n64_texture_pipe_t::fetch_rgba16_raw; diff --git a/src/mame/video/stic.cpp b/src/mame/video/stic.cpp index b5b8dbfb6a4..350544e8f90 100644 --- a/src/mame/video/stic.cpp +++ b/src/mame/video/stic.cpp @@ -760,8 +760,8 @@ void stic_device::screenrefresh() render_background(m_bitmap); // Render the sprites into their buffers render_sprites(); - for (int i = 0; i < STIC_MOBS; i++) - m_sprite[i].collision = 0; + for (auto & elem : m_sprite) + elem.collision = 0; // Copy the sprites to the background copy_sprites_to_background(m_bitmap); determine_sprite_collisions(); diff --git a/src/mame/video/tc0100scn.cpp b/src/mame/video/tc0100scn.cpp index 3ecbc3623d8..e63bd9b0c25 100644 --- a/src/mame/video/tc0100scn.cpp +++ b/src/mame/video/tc0100scn.cpp @@ -318,8 +318,8 @@ void tc0100scn_device::device_reset() m_dblwidth = 0; m_gfxbank = 0; /* Mjnquest uniquely banks tiles */ - for (int i = 0; i < 8; i++) - m_ctrl[i] = 0; + for (auto & elem : m_ctrl) + elem = 0; } diff --git a/src/mame/video/tc0360pri.cpp b/src/mame/video/tc0360pri.cpp index 43bf42ee1ef..e3620cb74ac 100644 --- a/src/mame/video/tc0360pri.cpp +++ b/src/mame/video/tc0360pri.cpp @@ -65,8 +65,8 @@ void tc0360pri_device::device_start() void tc0360pri_device::device_reset() { - for (int i = 0; i < 16; i++) - m_regs[i] = 0; + for (auto & elem : m_regs) + elem = 0; } diff --git a/src/mame/video/tc0480scp.cpp b/src/mame/video/tc0480scp.cpp index d50a77c6ace..df66f8afb3b 100644 --- a/src/mame/video/tc0480scp.cpp +++ b/src/mame/video/tc0480scp.cpp @@ -317,8 +317,8 @@ void tc0480scp_device::device_reset() { m_dblwidth = 0; - for (int i = 0; i < 0x18; i++) - m_ctrl[i] = 0; + for (auto & elem : m_ctrl) + elem = 0; } -- cgit v1.2.3