Skip to content

Commit 19f6311

Browse files
authored
Merge pull request #277 from JohnTitor/note-fixed-int-2s-complement
Clarify casting between the same size fixed ints
2 parents fa1326c + 2df3009 commit 19f6311

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/casts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ expression, `e as U2` is not necessarily so.
4646
For numeric casts, there are quite a few cases to consider:
4747

4848
* casting between two integers of the same size (e.g. i32 -> u32) is a no-op
49+
(Rust uses 2's complement for negative values of fixed integers)
4950
* casting from a larger integer to a smaller integer (e.g. u32 -> u8) will
5051
truncate
5152
* casting from a smaller integer to a larger integer (e.g. u8 -> u32) will

0 commit comments

Comments
 (0)