File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,8 @@ impl MemoryMapTag {
13
13
let self_ptr = self as * const MemoryMapTag ;
14
14
let start_area = ( & self . first_area ) as * const MemoryArea ;
15
15
MemoryAreaIter {
16
- current_area : start_area,
17
- last_area : ( self_ptr as u64 + ( self . size - self . entry_size ) as u64 )
18
- as * const MemoryArea ,
16
+ current_area : start_area as u64 ,
17
+ last_area : ( self_ptr as u64 + ( self . size - self . entry_size ) as u64 ) ,
19
18
entry_size : self . entry_size ,
20
19
}
21
20
}
@@ -46,8 +45,8 @@ impl MemoryArea {
46
45
47
46
#[ derive( Clone , Debug ) ]
48
47
pub struct MemoryAreaIter {
49
- current_area : * const MemoryArea ,
50
- last_area : * const MemoryArea ,
48
+ current_area : u64 ,
49
+ last_area : u64 ,
51
50
entry_size : u32 ,
52
51
}
53
52
@@ -57,9 +56,8 @@ impl Iterator for MemoryAreaIter {
57
56
if self . current_area > self . last_area {
58
57
None
59
58
} else {
60
- let area = unsafe { & * self . current_area } ;
61
- self . current_area = ( ( self . current_area as u64 ) + self . entry_size as u64 )
62
- as * const MemoryArea ;
59
+ let area = unsafe { & * ( self . current_area as * const MemoryArea ) } ;
60
+ self . current_area = self . current_area + ( self . entry_size as u64 ) ;
63
61
if area. typ == 1 {
64
62
Some ( area)
65
63
} else { self . next ( ) }
You can’t perform that action at this time.
0 commit comments