Skip to content

Commit

Permalink
Use an extra assert! to avoid bounds checks.
Browse files Browse the repository at this point in the history
This change has been suggested by @okaneco in image-rs#414 (comment) - thanks!

Co-authored-by: Collyn O'Kane <[email protected]>
  • Loading branch information
anforowicz and okaneco authored Oct 2, 2023
1 parent f5021fb commit 403d18f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ mod simd {
prev_row = &prev_row[3..];
curr_row = &mut curr_row[3..];
}
assert!(prev_row.len() >= 3 && curr_row.len() >= 3);
// Can't use `u8x4::from_slice` for the last `[u8;3]`.
let b = load3(prev_row);
let mut x = load3(curr_row);
Expand Down

0 comments on commit 403d18f

Please sign in to comment.