Skip to content

Commit 038097c

Browse files
authored
Merge pull request #2200 from joshlf/patch-8
[type layout] usize and isize have the same size and alignment
2 parents f584bf2 + dc2906c commit 038097c

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
@@ -42,9 +42,12 @@ The size of most primitives is given in this table.
4242
| `f64` | 8 |
4343
| `char` | 4 |
4444

45-
r[layout.primitive.size-int]
45+
r[layout.primitive.size-minimum]
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

48+
r[layout.primitive.size-align]
49+
`usize` and `isize` have the same size and alignment.
50+
4851
r[layout.primitive.align]
4952
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.
5053

0 commit comments

Comments
 (0)