File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -146,10 +146,11 @@ impl<S: PageSize> core::iter::Step for PhysFrame<S> {
146
146
use core:: convert:: TryFrom ;
147
147
148
148
match u64:: try_from ( count) {
149
- Ok ( n) => match start. start_address ( ) . as_u64 ( ) . overflowing_add ( n * S :: SIZE ) {
150
- ( _, true ) => None ,
151
- ( start_addr, false ) => Self :: from_start_address ( PhysAddr :: new ( start_addr) ) . ok ( ) ,
152
- } ,
149
+ Ok ( n) => start
150
+ . start_address ( )
151
+ . as_u64 ( )
152
+ . checked_add ( n * S :: SIZE )
153
+ . and_then ( |start_addr| Self :: from_start_address ( PhysAddr :: new ( start_addr) ) . ok ( ) ) ,
153
154
Err ( _) => None , // if n is out of range, `unsigned_start + n`
154
155
}
155
156
}
@@ -158,10 +159,11 @@ impl<S: PageSize> core::iter::Step for PhysFrame<S> {
158
159
use core:: convert:: TryFrom ;
159
160
160
161
match u64:: try_from ( count) {
161
- Ok ( n) => match start. start_address ( ) . as_u64 ( ) . overflowing_sub ( n * S :: SIZE ) {
162
- ( _, true ) => None ,
163
- ( start_addr, false ) => Self :: from_start_address ( PhysAddr :: new ( start_addr) ) . ok ( ) ,
164
- } ,
162
+ Ok ( n) => start
163
+ . start_address ( )
164
+ . as_u64 ( )
165
+ . checked_sub ( n * S :: SIZE )
166
+ . and_then ( |start_addr| Self :: from_start_address ( PhysAddr :: new ( start_addr) ) . ok ( ) ) ,
165
167
Err ( _) => None , // if n is out of range, `unsigned_start + n`
166
168
}
167
169
}
You can’t perform that action at this time.
0 commit comments