Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/pixbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Pixbuf {
let bits_per_sample = bits_per_sample as usize;

let n_channels = if has_alpha { 4 } else { 3 };
let last_row_len = width * ((n_channels * bits_per_sample + 7) / 8);
let last_row_len = width * (n_channels * bits_per_sample).div_ceil(8);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing a 7 isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a +7 before and that change seemed unrelated to clippy fixes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That (x + 7) / 8 is the same as dividing by 8 and rounding up (which is what div_ceil() does)


let mut data: Box<T> = Box::new(data);

Expand Down
2 changes: 1 addition & 1 deletion gio/src/input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl<T: IsA<InputStream>> InputStreamAsyncBufRead<T> {

fn set_has_data(&mut self, buffer: Vec<u8>, valid: (usize, usize)) {
match self.state {
State::Reading { .. } | State::Transitioning { .. } => {
State::Reading { .. } | State::Transitioning => {
self.state = State::HasData { buffer, valid }
}
_ => panic!("Invalid state"),
Expand Down
Loading