Because bytes tend to be longer, we'll want to use hex style mapping to represent bits. We know that hexadecimal is base 16 and bits are base 2 which translates to 4 bits = 1 hex.
Here's an example of why we want this case. If you have 16 bits, it looks like: 000011111111 but 0xFF is easier to read.
Here's a list of mapping for wanting only 1 bits: 0 -> 0x0 1 -> 0x1 11 -> 0x3 111 -> 0x7 1111 -> 0xF ... repeat the pattern for the next digit 1 1111 -> 0x1F 11 1111 -> 0x3F 111 1111 -> 0x7F 1111 1111 -> 0xFF
It'll be good to have this pattern in your head if you're staring at a lot of logic which involves value extraction from x bits.