We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
div_ceil
1 parent 9af152d commit 986c2e9Copy full SHA for 986c2e9
drivers/gpu/drm/drm_panic_qr.rs
@@ -545,7 +545,7 @@ impl EncodedMsg<'_> {
545
}
546
self.push(&mut offset, (MODE_STOP, 4));
547
548
- let pad_offset = (offset + 7) / 8;
+ let pad_offset = offset.div_ceil(8);
549
for i in pad_offset..self.version.max_data() {
550
self.data[i] = PADDING[(i & 1) ^ (pad_offset & 1)];
551
@@ -659,7 +659,7 @@ struct QrImage<'a> {
659
impl QrImage<'_> {
660
fn new<'a, 'b>(em: &'b EncodedMsg<'b>, qrdata: &'a mut [u8]) -> QrImage<'a> {
661
let width = em.version.width();
662
- let stride = (width + 7) / 8;
+ let stride = width.div_ceil(8);
663
let data = qrdata;
664
665
let mut qr_image = QrImage {
0 commit comments