Skip to content

Commit 4e8f63e

Browse files
committed
chore: Resolve clippy::manual_div_ceil lints
1 parent b3f9055 commit 4e8f63e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

h263/src/decoder/cpu/gather.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn read_sample(
3333
/// Linear interpolation between two values by 0 or 50%.
3434
fn lerp(sample_a: u8, sample_b: u8, middle: bool) -> u8 {
3535
if middle {
36-
((sample_a as u16 + sample_b as u16 + 1) / 2) as u8
36+
(sample_a as u16 + sample_b as u16).div_ceil(2) as u8
3737
} else {
3838
sample_a
3939
}

yuv/src/bt601.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ pub fn yuv420_to_rgba(y: &[u8], chroma_b: &[u8], chroma_r: &[u8], y_width: usize
111111
return vec![];
112112
}
113113

114-
// the + 1 is for rounding odd numbers up
115-
let br_width = (y_width + 1) / 2;
114+
// rounding odd numbers up
115+
let br_width = y_width.div_ceil(2);
116116

117117
debug_assert_eq!(y.len() % y_width, 0);
118118
debug_assert_eq!(chroma_b.len() % br_width, 0);
@@ -122,8 +122,8 @@ pub fn yuv420_to_rgba(y: &[u8], chroma_b: &[u8], chroma_r: &[u8], y_width: usize
122122
let y_height = y.len() / y_width;
123123
let br_height = chroma_b.len() / br_width;
124124

125-
// the + 1 is for rounding odd numbers up
126-
debug_assert_eq!((y_height + 1) / 2, br_height);
125+
// rounding odd numbers up
126+
debug_assert_eq!(y_height.div_ceil(2), br_height);
127127

128128
let mut rgba = vec![0; y.len() * 4];
129129
let rgba_stride = y_width * 4; // 4 bytes per pixel, interleaved

0 commit comments

Comments
 (0)