mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: Remove manual implementation of is_power_of_two
As clippy of rust-toolchain version 1.83.0-beta.1 suggests, remove manual implementation of `is_power_of_two` to improve readability. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
@@ -734,7 +734,7 @@ impl PciConfiguration {
|
||||
return Err(Error::BarInUse(bar_idx));
|
||||
}
|
||||
|
||||
if config.size.count_ones() != 1 {
|
||||
if !config.size.is_power_of_two() {
|
||||
return Err(Error::BarSizeInvalid(config.size));
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ impl PciConfiguration {
|
||||
return Err(Error::RomBarInUse(bar_idx));
|
||||
}
|
||||
|
||||
if config.size.count_ones() != 1 {
|
||||
if !config.size.is_power_of_two() {
|
||||
return Err(Error::RomBarSizeInvalid(config.size));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user