From e32f0d1e6102d2cf5e5199ca98f65b73bbc7015e Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 11 Jul 2023 10:31:03 +0200 Subject: [PATCH] wrap around timer --- hbvm/src/vm/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbvm/src/vm/mod.rs b/hbvm/src/vm/mod.rs index 65281611..8505ff1f 100644 --- a/hbvm/src/vm/mod.rs +++ b/hbvm/src/vm/mod.rs @@ -135,7 +135,7 @@ impl<'a, T: HandleTrap, const TIMER_QUOTIENT: usize> Vm<'a, T, TIMER_QUOTIENT> { else { return Ok(VmRunOk::End) }; if TIMER_QUOTIENT != 0 { - self.timer += 1; + self.timer = self.timer.wrapping_add(1); if self.timer % TIMER_QUOTIENT == 0 { return Ok(VmRunOk::Timer); }