Skip to content

Commit bc88e9a

Browse files
authored
Clarify that align_offset overaligns
The current documentation is not clear whether adding `a` to a pointer overaligns (align up) or underaligns (align down). It should say this explicitly. cc @nagisa
1 parent b2dd217 commit bc88e9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/core/src/ptr/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,10 +2166,10 @@ pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
21662166
}
21672167
}
21682168

2169-
/// Align pointer `p`.
2169+
/// Overalign pointer `p`.
21702170
///
2171-
/// Calculate offset (in terms of elements of `size_of::<T>()` stride) that has to be applied
2172-
/// to pointer `p` so that pointer `p` would get aligned to `a`.
2171+
/// Calculate offset (in terms of elements of `size_of::<T>()` stride) that has to be added
2172+
/// to pointer `p` so that pointer `p` would get overaligned to `a`.
21732173
///
21742174
/// # Safety
21752175
/// `a` must be a power of two.

0 commit comments

Comments
 (0)