Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
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?
-
@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. -
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. -
matt-jd10305yWell do you have to use it? I mostly do use it closer to metal, higher level abstractions usually have better ways to handle flags
Related Rants
-
Python5Biggest dev insecurity? Probably http:// It’s not secure at all, never feeling very confident when browsing...
-
bittersweet13Insecure... My laptop disk is encrypted, but I'm using a fairly weak password. 🤔 Oh, you mean psychologica...
-
dder8You know that feeling, when you code, compile, run. It just works ? That’s the moment I get insecure
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.
rant
wk207