From a81d082e16aaffc6eb3e0d85f56ca67b40bfc089 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Mon, 24 Apr 2023 16:05:07 +1000 Subject: [PATCH] fix crash --- lib/src/processor/memory/mmio/apu/channels.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/processor/memory/mmio/apu/channels.rs b/lib/src/processor/memory/mmio/apu/channels.rs index 8e18045..1327772 100644 --- a/lib/src/processor/memory/mmio/apu/channels.rs +++ b/lib/src/processor/memory/mmio/apu/channels.rs @@ -506,8 +506,9 @@ struct Lfsr { impl Lfsr { fn update(&mut self) { - self.interval = - (1 << (self.clock_shift as u16)) * (1 + (2 * self.clock_divider as u16)) * 8; + self.interval = (1_u16 << (self.clock_shift as u16)) + .wrapping_mul(1 + (2 * self.clock_divider as u16)) + .wrapping_mul(8); } fn tick(&mut self) {