diff options
author | 2021-02-14 11:05:57 -0500 | |
---|---|---|
committer | 2021-02-14 11:05:57 -0500 | |
commit | bc0146c2038c46f789a246d5616afd7c425157f3 (patch) | |
tree | b4d39194034b4c6e56ccd4035d25636034be43ca /src/devices/cpu/mips/r4000.cpp | |
parent | 91310bcdeb7ab0ff661738b212017bf836f4e8ad (diff) |
Eliminate ARRAY_LENGTH template in favor of C++17's std::size
* osdcomm.h: Move definition of EQUIVALENT_ARRAY to coretmpl.h
* sharc.cpp, gt64xxx.cpp, ym2413.cpp, gb_lcd.cpp, snes_ppu.cpp: Use STRUCT_MEMBER for save state registration
* gio/newport.cpp, megadrive/svp.cpp, nes_ctrl/bcbattle.cpp, arm7.cpp, tms9995.cpp, pckeybrd.cpp, sa1110.cpp, sa1111.cpp, jangou_blitter.cpp, vic4567.cpp: Use std::fill(_n) instead of memset
* emucore.h: Remove obsolete typedef
Diffstat (limited to 'src/devices/cpu/mips/r4000.cpp')
-rw-r--r-- | src/devices/cpu/mips/r4000.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/devices/cpu/mips/r4000.cpp b/src/devices/cpu/mips/r4000.cpp index fcdddbaabe9..d88210c9d79 100644 --- a/src/devices/cpu/mips/r4000.cpp +++ b/src/devices/cpu/mips/r4000.cpp @@ -225,7 +225,7 @@ void r4000_base_device::device_reset() m_cp0[CP0_WatchHi] = 0; // initialize tlb mru index with identity mapping - for (unsigned i = 0; i < ARRAY_LENGTH(m_tlb); i++) + for (unsigned i = 0; i < std::size(m_tlb); i++) { m_tlb_mru[TRANSLATE_READ][i] = i; m_tlb_mru[TRANSLATE_WRITE][i] = i; @@ -1411,10 +1411,10 @@ u64 r4000_base_device::cp0_get(unsigned const reg) { u8 const wired = m_cp0[CP0_Wired] & 0x3f; - if (wired < ARRAY_LENGTH(m_tlb)) - return ((total_cycles() - m_cp0_timer_zero) % (ARRAY_LENGTH(m_tlb) - wired) + wired) & 0x3f; + if (wired < std::size(m_tlb)) + return ((total_cycles() - m_cp0_timer_zero) % (std::size(m_tlb) - wired) + wired) & 0x3f; else - return ARRAY_LENGTH(m_tlb) - 1; + return std::size(m_tlb) - 1; } break; @@ -1525,7 +1525,7 @@ void r4000_base_device::cp0_tlbr() { u8 const index = m_cp0[CP0_Index] & 0x3f; - if (index < ARRAY_LENGTH(m_tlb)) + if (index < std::size(m_tlb)) { tlb_entry const &entry = m_tlb[index]; @@ -1538,7 +1538,7 @@ void r4000_base_device::cp0_tlbr() void r4000_base_device::cp0_tlbwi(u8 const index) { - if (index < ARRAY_LENGTH(m_tlb)) + if (index < std::size(m_tlb)) { tlb_entry &entry = m_tlb[index]; @@ -1563,9 +1563,9 @@ void r4000_base_device::cp0_tlbwi(u8 const index) void r4000_base_device::cp0_tlbwr() { u8 const wired = m_cp0[CP0_Wired] & 0x3f; - u8 const unwired = ARRAY_LENGTH(m_tlb) - wired; + u8 const unwired = std::size(m_tlb) - wired; - u8 const index = (unwired > 0) ? ((total_cycles() - m_cp0_timer_zero) % unwired + wired) & 0x3f : (ARRAY_LENGTH(m_tlb) - 1); + u8 const index = (unwired > 0) ? ((total_cycles() - m_cp0_timer_zero) % unwired + wired) & 0x3f : (std::size(m_tlb) - 1); cp0_tlbwi(index); } @@ -1573,7 +1573,7 @@ void r4000_base_device::cp0_tlbwr() void r4000_base_device::cp0_tlbp() { m_cp0[CP0_Index] = 0x80000000; - for (u8 index = 0; index < ARRAY_LENGTH(m_tlb); index++) + for (u8 index = 0; index < std::size(m_tlb); index++) { tlb_entry const &entry = m_tlb[index]; @@ -3615,7 +3615,7 @@ r4000_base_device::translate_result r4000_base_device::translate(int intention, bool invalid = false; bool modify = false; - for (unsigned i = 0; i < ARRAY_LENGTH(m_tlb); i++) + for (unsigned i = 0; i < std::size(m_tlb); i++) { unsigned const index = mru[i]; tlb_entry const &entry = m_tlb[index]; |