File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ impl From<VirtPageNum> for usize {
7373
7474impl VirtAddr {
7575 pub fn floor ( & self ) -> VirtPageNum { VirtPageNum ( self . 0 / PAGE_SIZE ) }
76- pub fn ceil ( & self ) -> VirtPageNum { VirtPageNum ( ( self . 0 + PAGE_SIZE - 1 ) / PAGE_SIZE ) }
76+ pub fn ceil ( & self ) -> VirtPageNum { VirtPageNum ( ( self . 0 - 1 + PAGE_SIZE ) / PAGE_SIZE ) }
7777 pub fn page_offset ( & self ) -> usize { self . 0 & ( PAGE_SIZE - 1 ) }
7878 pub fn aligned ( & self ) -> bool { self . page_offset ( ) == 0 }
7979}
@@ -88,7 +88,7 @@ impl From<VirtPageNum> for VirtAddr {
8888}
8989impl PhysAddr {
9090 pub fn floor ( & self ) -> PhysPageNum { PhysPageNum ( self . 0 / PAGE_SIZE ) }
91- pub fn ceil ( & self ) -> PhysPageNum { PhysPageNum ( ( self . 0 + PAGE_SIZE - 1 ) / PAGE_SIZE ) }
91+ pub fn ceil ( & self ) -> PhysPageNum { PhysPageNum ( ( self . 0 - 1 + PAGE_SIZE ) / PAGE_SIZE ) }
9292 pub fn page_offset ( & self ) -> usize { self . 0 & ( PAGE_SIZE - 1 ) }
9393 pub fn aligned ( & self ) -> bool { self . page_offset ( ) == 0 }
9494}
You can’t perform that action at this time.
0 commit comments