Skip to content

Commit

Permalink
fn invert: Calculate y_off var with multiplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkysen committed Sep 18, 2023
1 parent b747b59 commit 7ff1214
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/wedge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,11 @@ const fn hflip(src: &[u8; 64 * 64]) -> [u8; 64 * 64] {
}

fn invert(dst: &mut [u8], src: &[u8], w: usize, h: usize) {
let mut y_off = 0;
for _ in 0..h {
for y in 0..h {
let y_off = y * w;
for x in 0..w {
dst[y_off + x] = 64 - src[y_off + x];
}
y_off += w;
}
}

Expand Down

0 comments on commit 7ff1214

Please sign in to comment.