Skip to content

Commit

Permalink
添加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
fslongjin committed Apr 15, 2024
1 parent 962be53 commit f1b3cdf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kernel/crates/rust-slabmalloc/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ impl Bitfield for [AtomicU64] {
}
}

/// # get_offset_for_align - 根据布局大小获取page内对齐偏移量
///
/// 这个函数根据给定的`Layout`大小确定一个合适的对齐偏移量。
///
/// ## 参数
///
/// - layout: Layout,这是需要计算对齐偏移量的布局参数。
///
/// ## 返回值
///
/// - usize: 成功时返回一个usize类型的对齐偏移量。
fn get_offset_for_align(layout: Layout) -> usize {
match layout.size() {
0..=8 => 80,
Expand Down

0 comments on commit f1b3cdf

Please sign in to comment.