Skip to content

Commit d2715c0

Browse files
authored
Merge pull request #2205 from joshlf/patch-11
Guarantee size and alignment of more integer primitives
2 parents 038097c + 82c2212 commit d2715c0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/type-layout.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ r[layout.primitive.size-minimum]
4848
r[layout.primitive.size-align]
4949
`usize` and `isize` have the same size and alignment.
5050

51-
r[layout.primitive.align]
51+
r[layout.primitive.platform-specific-alignment]
5252
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.
5353

54+
r[layout.primitive.integer-alignment]
55+
Alignment is guaranteed to be the same for fixed-width signed and unsigned integer variants of the same indicated size --- that is, for a given size `N`, `align_of::<uN>() == align_of::<iN>()`.
56+
5457
r[layout.pointer]
5558
## Pointers and references layout
5659

0 commit comments

Comments
 (0)