Skip to content

Commit 105a943

Browse files
authored
Merge pull request #1046 from JohnTitor/note-fixed-int-2s-complement
Add a note why the same size int casting is a no-op
2 parents aacd887 + 455773b commit 105a943

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/expressions/operator-expr.md

+1
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ reference types and `mut` or `const` in pointer types.
340340
#### Numeric cast
341341

342342
* Casting between two integers of the same size (e.g. i32 -> u32) is a no-op
343+
(Rust uses 2's complement for negative values of fixed integers)
343344
* Casting from a larger integer to a smaller integer (e.g. u32 -> u8) will
344345
truncate
345346
* Casting from a smaller integer to a larger integer (e.g. u8 -> u32) will

0 commit comments

Comments
 (0)