Skip to content

Commit

Permalink
Use wrapping_add in g32_addr, fixing arm test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jan 15, 2025
1 parent 61f45a7 commit 36b50d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pulley/src/interp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@ impl Interpreter<'_> {

/// Calculates the "g32" address given the inputs to the addressing mode.
fn g32_addr<T>(&self, base: XReg, addr: XReg, offset: u8) -> *mut T {
let addr = self.state[base].get_ptr::<T>() as usize
+ self.state[addr].get_u32() as usize
+ usize::from(offset);
let addr = (self.state[base].get_ptr::<T>() as usize)
.wrapping_add(self.state[addr].get_u32() as usize)
.wrapping_add(usize::from(offset));
addr as *mut T
}

Expand Down

0 comments on commit 36b50d9

Please sign in to comment.