We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
div_ceil
1 parent 7a29741 commit 44619fdCopy full SHA for 44619fd
src/interlace.rs
@@ -118,10 +118,8 @@ fn deinterlace_bits(png: &PngImage) -> Vec<u8> {
118
let mut current_y: usize = pass_constants.y_shift as usize;
119
for line in png.scan_lines(false) {
120
let bit_vec = line.data.view_bits::<Msb0>();
121
- let bits_in_line = ((png.ihdr.width - u32::from(pass_constants.x_shift)
122
- + u32::from(pass_constants.x_step)
123
- - 1)
124
- / u32::from(pass_constants.x_step)) as usize
+ let bits_in_line = (png.ihdr.width - u32::from(pass_constants.x_shift))
+ .div_ceil(u32::from(pass_constants.x_step)) as usize
125
* bits_per_pixel;
126
for (i, bit) in bit_vec.iter().by_vals().enumerate() {
127
// Avoid moving padded 0's into new image
0 commit comments