That's called a mask. Which is what I said to and with first. But you might not want to write out manually numbers like this and it would be easier to simply shift one number or the other. 1 << 2 & var is just as valid. It depends on both your preference and use case and produces the same exact result.
View all comments
Show parent comment
1
u/Im_a_hamburger Oct 07 '26
Rather than having to write var >> 2 & 1 so var & 0b00000100