mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-04 08:03:55 +00:00
misc: Fix clippy - manually reimplementing div_ceil
Reported by 1.86.0-beta.1 (f0cb41030 2025-02-17). Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
c441bb2968
commit
4de422ad69
@ -299,7 +299,7 @@ pub struct TdHob {
|
||||
}
|
||||
|
||||
fn align_hob(v: u64) -> u64 {
|
||||
(v + 7) / 8 * 8
|
||||
v.div_ceil(8) * 8
|
||||
}
|
||||
|
||||
impl TdHob {
|
||||
|
@ -502,7 +502,7 @@ impl QcowFile {
|
||||
if refcount_bits != 16 {
|
||||
return Err(Error::UnsupportedRefcountOrder);
|
||||
}
|
||||
let refcount_bytes = (refcount_bits + 7) / 8;
|
||||
let refcount_bytes = refcount_bits.div_ceil(8);
|
||||
|
||||
// Need at least one refcount cluster
|
||||
if header.refcount_table_clusters == 0 {
|
||||
|
@ -108,7 +108,7 @@ struct PartiallyBalloonedPage {
|
||||
impl PartiallyBalloonedPage {
|
||||
fn new() -> Self {
|
||||
let page_size = get_page_size();
|
||||
let len = ((page_size >> VIRTIO_BALLOON_PFN_SHIFT) + 63) / 64;
|
||||
let len = (page_size >> VIRTIO_BALLOON_PFN_SHIFT).div_ceil(64);
|
||||
// Initial each padding bit as 1 in bitmap.
|
||||
let mut bitmap = vec![0_u64; len as usize];
|
||||
let pad_num = len * 64 - (page_size >> VIRTIO_BALLOON_PFN_SHIFT);
|
||||
@ -134,7 +134,7 @@ impl PartiallyBalloonedPage {
|
||||
}
|
||||
|
||||
fn reset(&mut self) {
|
||||
let len = ((self.page_size >> VIRTIO_BALLOON_PFN_SHIFT) + 63) / 64;
|
||||
let len = (self.page_size >> VIRTIO_BALLOON_PFN_SHIFT).div_ceil(64);
|
||||
self.addr = 0;
|
||||
self.bitmap = vec![0; len as usize];
|
||||
let pad_num = len * 64 - (self.page_size >> VIRTIO_BALLOON_PFN_SHIFT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user