File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,8 @@ impl ServerBackend for TestBackend {
89
89
if region == VFIO_PCI_CONFIG_REGION_INDEX {
90
90
if len > 4 {
91
91
// For larger accesses require multiple of 4 and natural
92
- assert ! ( len % 4 == 0 ) ;
93
- assert ! ( offset % 4 == 0 ) ;
92
+ assert ! ( len. is_multiple_of ( 4 ) ) ;
93
+ assert ! ( offset. is_multiple_of ( 4 ) ) ;
94
94
let mut reg_idx = offset as usize / 4 ;
95
95
let mut data_offset = 0 ;
96
96
while data_offset < len {
@@ -115,7 +115,7 @@ impl ServerBackend for TestBackend {
115
115
} else if region == VFIO_PCI_BAR2_REGION_INDEX && offset == 0 {
116
116
info ! ( "gpio value read: count = {}" , self . count) ;
117
117
self . count += 1 ;
118
- if self . count . 0 % 3 == 0 {
118
+ if self . count . 0 . is_multiple_of ( 3 ) {
119
119
data[ 0 ] = 1 ;
120
120
if let Some ( irq) = & mut self . irq {
121
121
info ! ( "Triggering interrupt for count = {}" , self . count) ;
Original file line number Diff line number Diff line change @@ -403,7 +403,7 @@ impl PciConfiguration {
403
403
404
404
/// Writes a 32bit dword to `offset`. `offset` must be 32bit aligned.
405
405
fn write_dword ( & mut self , offset : usize , value : u32 ) {
406
- if offset % 4 != 0 {
406
+ if ! offset. is_multiple_of ( 4 ) {
407
407
warn ! ( "bad PCI config dword write offset {offset}" ) ;
408
408
return ;
409
409
}
@@ -494,7 +494,7 @@ impl PciConfiguration {
494
494
return Err ( Error :: BarSizeInvalid ( config. size ) ) ;
495
495
}
496
496
497
- if config. addr % config. size != 0 {
497
+ if ! config. addr . is_multiple_of ( config. size ) {
498
498
return Err ( Error :: BarAlignmentInvalid ( config. addr , config. size ) ) ;
499
499
}
500
500
You can’t perform that action at this time.
0 commit comments