Skip to content

Commit 1fa8606

Browse files
authored
Guarantee alignment of fixed-width integer primitives
1 parent 91f1444 commit 1fa8606

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/type-layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ r[layout.primitive.size-int]
4646
`usize` and `isize` have a size big enough to contain every address on the target platform. For example, on a 32 bit target, this is 4 bytes, and on a 64 bit target, this is 8 bytes.
4747

4848
r[layout.primitive.align]
49-
The alignment of primitives is platform-specific. In most cases, their alignment is equal to their size, but it may be less. In particular, `i128` and `u128` are often aligned to 4 or 8 bytes even though their size is 16, and on many 32-bit platforms, `i64`, `u64`, and `f64` are only aligned to 4 bytes, not 8.
49+
The alignment of primitives is platform-specific. In most cases, their alignment is equal to their size, but it may be less. In particular, `i128` and `u128` are often aligned to 4 or 8 bytes even though their size is 16, and on many 32-bit platforms, `i64`, `u64`, and `f64` are only aligned to 4 bytes, not 8. Alignment is guaranteed to be the same for signed and unsigned variants – that is, for a given `N`, `align_of::<uN>() == align_of::<iN>()`.
5050

5151
r[layout.pointer]
5252
## Pointers and references layout

0 commit comments

Comments
 (0)