From 4f53fb1c875a9cd406b475c56b101f3e7f13e3b3 Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 11 Jul 2023 10:32:26 +0200 Subject: [PATCH] Moved --- hbvm/src/vm/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hbvm/src/vm/mod.rs b/hbvm/src/vm/mod.rs index 8505ff1..4997c5a 100644 --- a/hbvm/src/vm/mod.rs +++ b/hbvm/src/vm/mod.rs @@ -134,13 +134,6 @@ impl<'a, T: HandleTrap, const TIMER_QUOTIENT: usize> Vm<'a, T, TIMER_QUOTIENT> { let Some(&opcode) = self.program.get(self.pc) else { return Ok(VmRunOk::End) }; - if TIMER_QUOTIENT != 0 { - self.timer = self.timer.wrapping_add(1); - if self.timer % TIMER_QUOTIENT == 0 { - return Ok(VmRunOk::Timer); - } - } - // Big match unsafe { match opcode { @@ -329,6 +322,13 @@ impl<'a, T: HandleTrap, const TIMER_QUOTIENT: usize> Vm<'a, T, TIMER_QUOTIENT> { } } } + + if TIMER_QUOTIENT != 0 { + self.timer = self.timer.wrapping_add(1); + if self.timer % TIMER_QUOTIENT == 0 { + return Ok(VmRunOk::Timer); + } + } } }