1

# I still have no idea how bit shifting and masking work. I don't have to use it in my day-to-day anymore but I briefly worked as a game developer and still occasionally do side gigs and personal game projects. When I was working on games as my day job I had to do a fair amount of masking for a bunch of different reasons. But I've never gotten the hang of it. Everytime I have to create a mask I have to Google it and then I'm like "oh yeah of course that's simple enough". But inevitably the next time I have to do it I end up back at square one.

• 0
I have issues with visualizing other things as well. What is it about masking and shifting that you struggle with? It is just logical operations on the bit level rather than evaluating an entire byte or bytes. Is your mental model for the byte good?
• 0
@Demolishun I think a have an understanding of how it works but I get mixed up on what Anding vs oring does. It's such a small piece. It's worth mentioning I have a form of Dysgraphia which is kind of like dyslexia but for writing instead of reading. I don't have much of an issue anymore but I do feel I have a harder time with things that have to do with mathematical "order" I guess.

Like, seeing a math equation I can explain exactly what it's doing and why. But if I have to write it myself I just blank. Unless it's something I've had to do over and over.
• 2
Its just "set bit at pos n". For the value to be 1 both must match on & (all), either must be 1 for | (any).

^ is exclusive, so it's 1 if only one of the bit values has one (Highlander).

Shifts just offset n position l Or r. They can be lossy. They're good for quick math.
• 0
Well do you have to use it? I mostly do use it closer to metal, higher level abstractions usually have better ways to handle flags