Created
November 11, 2019 19:14
-
-
Save rust-play/4eb7efb7c8fb78f939465580536585a0 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut x = 41; | |
x ^= 1; | |
for i in 0..(std::mem::size_of::<usize>()*8) { | |
if x & (1 << i) == 0 { x ^= 1 << (i+1); } else { break; } | |
} | |
println!("{}", x); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment