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 /emulator.cpp | |
parent | 71b89bc9ceb59f2603cf4b0635849269597a4823 (diff) |
Optimize compile times by removing find_if usage
Diffstat (limited to 'emulator.cpp')
-rw-r--r-- | emulator.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/emulator.cpp b/emulator.cpp index e3ac6bb..034fc57 100644 --- a/emulator.cpp +++ b/emulator.cpp @@ -25,7 +25,6 @@ #include "musashi-m68k/m68kcpu.h" #include <arpa/inet.h> -#include <algorithm> #include <cassert> #include <cstdio> #include <cstdint> @@ -406,20 +405,18 @@ static void PrintInstructionTrace(const uint32_t pc) int m68k_instr_callback(const int pc) { g_pc_backtrace.Push(pc); - const auto it = std::find_if( - code_bkpts.begin(), - code_bkpts.end(), - [&](const Breakpoint& b) { return b.offset == static_cast<uint32_t>(pc); }); - if (it != code_bkpts.end()) { - g_m68k_debug.RaiseBreakpoint(); - m68k_end_timeslice(); - printf("Breakpoint @ 0x%08x\n", pc); - g_pc_backtrace.Normalize(); - printf("PC backtrace (size=%zu):\n", g_pc_backtrace.Size()); - for (size_t i = 0; i < g_pc_backtrace.Size(); i++) { - PrintInstructionTrace(g_pc_backtrace.buffer[i]); + for (size_t bi = 0; bi < code_bkpts.size(); bi++) { + if (code_bkpts[bi].offset == static_cast<uint32_t>(pc)) { + g_m68k_debug.RaiseBreakpoint(); + m68k_end_timeslice(); + printf("Breakpoint @ 0x%08x\n", pc); + g_pc_backtrace.Normalize(); + printf("PC backtrace (size=%zu):\n", g_pc_backtrace.Size()); + for (size_t i = 0; i < g_pc_backtrace.Size(); i++) { + PrintInstructionTrace(g_pc_backtrace.buffer[i]); + } + return 1; } - return 1; } if (DEBUG_TRACE_INSTRUCTIONS) { PrintInstructionTrace(pc); |