Created
November 21, 2023 02:47
-
-
Save ArtemGr/eea36c16de8b711e6b251cb8387b65fa to your computer and use it in GitHub Desktop.
bit get set
This file contains hidden or 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
pub fn main() { | |
let mut hot = 0u128; | |
for ix in [0, 127] {hot |= 1 << ix} | |
println! ("{:b}", hot); | |
assert! (hot & (1 << 0) != 0); | |
assert! (hot & (1 << 126) == 0); | |
assert! (hot & (1 << 127) != 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment