wrap around timer

This commit is contained in:
Erin 2023-07-11 10:31:03 +02:00 committed by ondra05
parent 81f79dc7a5
commit e32f0d1e61

View file

@ -135,7 +135,7 @@ impl<'a, T: HandleTrap, const TIMER_QUOTIENT: usize> Vm<'a, T, TIMER_QUOTIENT> {
else { return Ok(VmRunOk::End) }; else { return Ok(VmRunOk::End) };
if TIMER_QUOTIENT != 0 { if TIMER_QUOTIENT != 0 {
self.timer += 1; self.timer = self.timer.wrapping_add(1);
if self.timer % TIMER_QUOTIENT == 0 { if self.timer % TIMER_QUOTIENT == 0 {
return Ok(VmRunOk::Timer); return Ok(VmRunOk::Timer);
} }