From 4beb9464683814d5990da794721bb5af65d41712 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 14 Sep 2016 22:49:35 +0300 Subject: [PATCH] Slight APU optimization --- Core/apu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/apu.c b/Core/apu.c index a359853..c1d62d3 100755 --- a/Core/apu.c +++ b/Core/apu.c @@ -64,6 +64,8 @@ static int16_t step_lfsr(uint16_t lfsr, bool uses_7_bit) static void GB_apu_run_internal(GB_gameboy_t *gb) { uint32_t steps = gb->apu.apu_cycles / (CPU_FREQUENCY/APU_FREQUENCY); + if (!steps) return; + gb->apu.apu_cycles %= (CPU_FREQUENCY/APU_FREQUENCY); for (uint8_t i = 0; i < 4; i++) { /* Phase */