all repos — mgba @ 32618a5b1d7fd6fcf010ffe81085b5caebe26caa

mGBA Game Boy Advance Emulator

GB Timer: Fix order-of-operations between & and +
Vicki Pfau vi@endrift.com
Thu, 29 Jun 2017 19:00:10 -0700
commit

32618a5b1d7fd6fcf010ffe81085b5caebe26caa

parent

15243a6ae9e4e2b4d4ff68245ae3c1fc823c745a

1 files changed, 1 insertions(+), 1 deletions(-)

jump to
M src/gb/timer.csrc/gb/timer.c

@@ -74,7 +74,7 @@ _GBTimerDivIncrement(timer, (timer->p->cpu->executionState + 1) & 3);

if (timer->internalDiv & (timer->timaPeriod >> 1)) { ++timer->p->memory.io[REG_TIMA]; if (!timer->p->memory.io[REG_TIMA]) { - mTimingSchedule(&timer->p->timing, &timer->irq, 4 - (timer->p->cpu->executionState + 1) & 3); + mTimingSchedule(&timer->p->timing, &timer->irq, 4 - ((timer->p->cpu->executionState + 1) & 3)); } } timer->p->memory.io[REG_DIV] = 0;