diff --git a/CHANGELOG.md b/CHANGELOG.md index 6813a098..faf0b584 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +**Version 0.3.1 (unreleased)** + - Performance optimizations + **Version 0.3.0** - Properly decode interlaced images - [SEMVER_MINOR] Allow converting between progressive and interlaced images ([#3](https://github.com/shssoichiro/oxipng/issues/3)) diff --git a/src/png.rs b/src/png.rs index 33a4b58d..55eb4a96 100644 --- a/src/png.rs +++ b/src/png.rs @@ -473,12 +473,8 @@ impl PngData { let (best_filter, best_line) = trials.iter() .min_by_key(|x| { x.1.iter().fold(0u64, |acc, &x| { - let signed: i16 = if x > 127 { - (x as i16) - 256 - } else { - x as i16 - }; - acc + signed.abs() as u64 + let signed = x as i8; + acc + (signed as i16).abs() as u64 }) }) .unwrap();