From 1c739e39e71dcbdd776bf0abf0b64761219e755e Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Fri, 18 Oct 2024 05:08:14 -0700 Subject: [PATCH] GBA DMA: Minor branch optimization --- src/gba/dma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gba/dma.c b/src/gba/dma.c index 5971b1b03..e9044d26a 100644 --- a/src/gba/dma.c +++ b/src/gba/dma.c @@ -319,9 +319,11 @@ void GBADMAService(struct GBA* gba, int number, struct GBADMA* info) { int i; for (i = 0; i < 4; ++i) { struct GBADMA* dma = &memory->dma[i]; - int32_t time = dma->when - info->when; - if (time < 0 && GBADMARegisterIsEnable(dma->reg) && dma->nextCount) { - dma->when = info->when; + if (GBADMARegisterIsEnable(dma->reg) && dma->nextCount) { + int32_t time = dma->when - info->when; + if (time < 0) { + dma->when = info->when; + } } }