Skip to content

Instantly share code, notes, and snippets.

@ArtemGr
Created November 21, 2023 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArtemGr/eea36c16de8b711e6b251cb8387b65fa to your computer and use it in GitHub Desktop.
Save ArtemGr/eea36c16de8b711e6b251cb8387b65fa to your computer and use it in GitHub Desktop.
bit get set
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