wrap around timer

This commit is contained in:
Erin 2023-07-11 10:31:03 +02:00
parent 5ee8a91479
commit ad96e83f09

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);
} }