Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kernel/src/libs/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ unsafe impl<const NUM: usize> SafeForZero for [u8; NUM] {}
/// 返回值:对齐后的地址。
pub const fn page_align_up(addr: usize) -> usize {
let page_size = MMArch::PAGE_SIZE;
return (addr + page_size - 1) & (!(page_size - 1));
return addr.wrapping_add(page_size - 1) & (!(page_size - 1));
}

pub const fn page_align_down(addr: usize) -> usize {
Expand Down
Loading