diff options
author | Oxore <oxore@protonmail.com> | 2024-05-22 23:44:38 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2024-05-22 23:44:38 +0300 |
commit | da7bab98907a700d1e525ccafe8f623d0927a724 (patch) | |
tree | b27773247c227003c8a68f7f7c3c2c1ac201bc19 /bus.cpp | |
parent | 71b89bc9ceb59f2603cf4b0635849269597a4823 (diff) |
Optimize compile times by removing find_if usage
Diffstat (limited to 'bus.cpp')
-rw-r--r-- | bus.cpp | 57 |
1 files changed, 28 insertions, 29 deletions
@@ -7,7 +7,6 @@ #include "vdp.hpp" #include "io.hpp" -#include <algorithm> #include <cassert> #include <cstdarg> #include <cstdbool> @@ -115,21 +114,21 @@ static inline bool ranges_overlap( static inline void m68k_read_callback(const uint32_t address, const uint32_t size) { - const auto access_it = std::find_if( - access_bkpts.begin(), - access_bkpts.end(), - [&](const Breakpoint& b) { return ranges_overlap(address, size, b.offset, b.length); }); - if (access_it != access_bkpts.end()) { - printf("Access watchpoint @ 0x%08x\n", address); - m68k_breakpoint_callback(); + for (size_t bi = 0; bi < access_bkpts.size(); bi++) { + const auto& b = access_bkpts[bi]; + if (ranges_overlap(address, size, b.offset, b.length)) { + printf("Access watchpoint @ 0x%08x\n", address); + m68k_breakpoint_callback(); + break; + } } - const auto it = std::find_if( - read_bkpts.begin(), - read_bkpts.end(), - [&](const Breakpoint& b) { return ranges_overlap(address, size, b.offset, b.length); }); - if (it != read_bkpts.end()) { - printf("Read watchpoint @ 0x%08x\n", address); - m68k_breakpoint_callback(); + for (size_t bi = 0; bi < read_bkpts.size(); bi++) { + const auto& b = read_bkpts[bi]; + if (ranges_overlap(address, size, b.offset, b.length)) { + printf("Read watchpoint @ 0x%08x\n", address); + m68k_breakpoint_callback(); + break; + } } } @@ -196,21 +195,21 @@ static inline void memory_write_concrete( static inline void m68k_write_callback(const uint32_t address, const uint32_t size) { - const auto access_it = std::find_if( - access_bkpts.begin(), - access_bkpts.end(), - [&](const Breakpoint& b) { return ranges_overlap(address, size, b.offset, b.length); }); - if (access_it != access_bkpts.end()) { - printf("Access watchpoint @ 0x%08x\n", address); - m68k_breakpoint_callback(); + for (size_t bi = 0; bi < access_bkpts.size(); bi++) { + const auto& b = access_bkpts[bi]; + if (ranges_overlap(address, size, b.offset, b.length)) { + printf("Access watchpoint @ 0x%08x\n", address); + m68k_breakpoint_callback(); + break; + } } - const auto it = std::find_if( - write_bkpts.begin(), - write_bkpts.end(), - [&](const Breakpoint& b) { return ranges_overlap(address, size, b.offset, b.length); }); - if (it != write_bkpts.end()) { - printf("Write watchpoint @ 0x%08x\n", address); - m68k_breakpoint_callback(); + for (size_t bi = 0; bi < read_bkpts.size(); bi++) { + const auto& b = read_bkpts[bi]; + if (ranges_overlap(address, size, b.offset, b.length)) { + printf("Write watchpoint @ 0x%08x\n", address); + m68k_breakpoint_callback(); + break; + } } } |