From ad96e83f095ac4667566fe2c59dbe0af2ed0c016 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 6528161..8505ff1 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); }