Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i32 -> u32 conversion described as "no-op" #261

Closed
jgarvin opened this issue Mar 28, 2021 · 0 comments · Fixed by #277
Closed

i32 -> u32 conversion described as "no-op" #261

jgarvin opened this issue Mar 28, 2021 · 0 comments · Fixed by #277

Comments

@jgarvin
Copy link

jgarvin commented Mar 28, 2021

From here: https://doc.rust-lang.org/nomicon/casts.html

casting between two integers of the same size (e.g. i32 -> u32) is a no-op

A signed integer can contain values an unsigned integer cannot, so even if this is true at the instruction level it seems misleading. Should maybe mention if Rust assumes 2s-complement representation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant