Skip to content

Commit

Permalink
don't compute residue twice
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 29, 2019
1 parent 9b66527 commit c1645f6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/intptrcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ impl<'mir, 'tcx> GlobalState {
/// Shifts `addr` to make it aligned with `align` by rounding `addr` to the smallest multiple
/// of `align` that is larger or equal to `addr`
fn align_addr(addr: u64, align: u64) -> u64 {
if addr % align == 0 {
addr
} else {
addr + align - addr % align
match addr % align {
0 => addr,
rem => addr + align - rem
}
}
}
Expand Down

0 comments on commit c1645f6

Please sign in to comment.