Skip to content

Commit

Permalink
Fix op_rem_w() overflow, as per RISC-V spec (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
fractasy authored Nov 20, 2024
1 parent 03d8f53 commit 0cd0f6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/zisk_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ pub const fn op_rem_w(a: u64, b: u64) -> (u64, bool) {
return ((a as i32) as u64, true);
}

(((a as i32) % (b as i32)) as u64, false)
((((a as i32) as i64) % ((b as i32) as i64)) as u64, false)
}
#[inline(always)]
pub fn opc_rem_w(ctx: &mut InstContext) {
Expand Down

0 comments on commit 0cd0f6a

Please sign in to comment.