summaryrefslogtreecommitdiff
path: root/bus.cpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2024-05-22 23:44:38 +0300
committerOxore <oxore@protonmail.com>2024-05-22 23:44:38 +0300
commitda7bab98907a700d1e525ccafe8f623d0927a724 (patch)
treeb27773247c227003c8a68f7f7c3c2c1ac201bc19 /bus.cpp
parent71b89bc9ceb59f2603cf4b0635849269597a4823 (diff)
Optimize compile times by removing find_if usage
Diffstat (limited to 'bus.cpp')
-rw-r--r--bus.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/bus.cpp b/bus.cpp
index f9aab5f..ac18208 100644
--- a/bus.cpp
+++ b/bus.cpp
@@ -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;
+ }
}
}