diff --git a/src/type-layout.md b/src/type-layout.md index 6466741893..0f5ee663c9 100644 --- a/src/type-layout.md +++ b/src/type-layout.md @@ -45,12 +45,18 @@ The size of most primitives is given in this table. r[layout.primitive.size-minimum] `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. -r[layout.primitive.size-align] -`usize` and `isize` have the same size and alignment. +r[layout.primitive.usize-isize-size-alignment] +Let `N` be the number of bits in a `usize` on a given platform (specifically, `size_of::() * 8`). On that platform, `usize`, `isize`, `uN`, and `iN` all have the same size and alignment. -r[layout.primitive.align] +r[layout.primitive.platform-specific-alignment] 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. +r[layout.primitive.integer-alignment] +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::() == align_of::()`. + +r[layout.primitive.char-alignment] +`char` is guaranteed to have the same alignment as `u32`. + r[layout.pointer] ## Pointers and references layout