Skip to content

Commit

Permalink
Eliminate extra length checks from diff() loop
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Oct 3, 2023
1 parent fb35bb1 commit 7b0d58a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,14 @@ fn diff<T: Pixel>(
) {
debug_assert!(dst.len() % src1.rect().width == 0);
let width = src1.rect().width;
if width == 0 || width != src2.rect().width {
let height = src1.rect().height;

if width == 0
|| width != src2.rect().width
|| height == 0
|| src1.rows_iter().len() != src2.rows_iter().len()
{
debug_assert!(false);
return;
}

Expand Down

0 comments on commit 7b0d58a

Please sign in to comment.