From 3e3ac23432849a79eee6c8b7e91eb4543ff15dfb Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Tue, 25 Apr 2023 13:35:25 +0300 Subject: [PATCH] More likely/unlikely fun --- Core/gb.c | 2 +- Core/sm83_cpu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/gb.c b/Core/gb.c index 063fa3f..783f10b 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -1163,7 +1163,7 @@ unsigned GB_run(GB_gameboy_t *gb) GB_ASSERT_NOT_RUNNING(gb) gb->vblank_just_occured = false; - if (gb->sgb && gb->sgb->intro_animation < 96) { + if (unlikely(gb->sgb && gb->sgb->intro_animation < 96)) { /* On the SGB, the GB is halted after finishing the boot ROM. Then, after the boot animation is almost done, it's reset. Since the SGB HLE does not perform any header validity checks, diff --git a/Core/sm83_cpu.c b/Core/sm83_cpu.c index fb36969..b590c00 100644 --- a/Core/sm83_cpu.c +++ b/Core/sm83_cpu.c @@ -1653,7 +1653,7 @@ static opcode_t *opcodes[256] = { }; void GB_cpu_run(GB_gameboy_t *gb) { - if (gb->stopped) { + if (unlikely(gb->stopped)) { GB_timing_sync(gb); GB_advance_cycles(gb, 4); if ((gb->io_registers[GB_IO_JOYP] & 0x30) != 0x30) { @@ -1699,7 +1699,7 @@ void GB_cpu_run(GB_gameboy_t *gb) } /* Call interrupt */ - else if (effective_ime && interrupt_queue) { + else if (unlikely(effective_ime && interrupt_queue)) { gb->halted = false; if (gb->hdma_on_hblank && (gb->io_registers[GB_IO_STAT] & 3) == 0 && gb->allow_hdma_on_wake) { gb->hdma_on = true;