From 3d94f14c5b16a4354442bccd49edc2ce13b8444c Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Tue, 10 Oct 2023 21:31:51 -0600 Subject: [PATCH] wrapping sub --- src/device/cop0.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/cop0.rs b/src/device/cop0.rs index 851a1f69..81bb1cc8 100644 --- a/src/device/cop0.rs +++ b/src/device/cop0.rs @@ -201,7 +201,7 @@ pub fn set_control_registers(device: &mut device::Device, index: u32, mut data: COP0_COMPARE_REG => { data &= 0xFFFFFFFF; let current_count = (device.cpu.cop0.regs[COP0_COUNT_REG as usize] >> 1) & 0xFFFFFFFF; - let mut compare_event_diff = data as u32 - current_count as u32; + let mut compare_event_diff = (data as u32).wrapping_sub(current_count as u32); if compare_event_diff == 0 { compare_event_diff += !0 as u32;