cm0002@lemmy.world to Programmer Humor@programming.dev · 1 day agoTell me the truth ...piefed.jeena.netimagemessage-square116linkfedilinkarrow-up11.04Karrow-down115
arrow-up11.02Karrow-down1imageTell me the truth ...piefed.jeena.netcm0002@lemmy.world to Programmer Humor@programming.dev · 1 day agomessage-square116linkfedilink
minus-squareethancedwards8@programming.devlinkfedilinkEnglisharrow-up2·5 hours agoOkay. Gen z programmer here. Can you explain this black magic? I see it all the time in kernel code but I have no idea what it means.
minus-squareNιƙƙιDιɱҽʂ@lemmy.worldlinkfedilinkarrow-up2·edit-21 hour agoIt’s called bitshifting and is used to select which bits you want to modify so you can toggle them individually. 1 << 0 is the flag for the first bit 1 << 1 for the second 1 << 2 for the third and so on I think that’s correct. It’s been years since I’ve used this technique tbh 😅
Okay. Gen z programmer here. Can you explain this black magic? I see it all the time in kernel code but I have no idea what it means.
It’s called bitshifting and is used to select which bits you want to modify so you can toggle them individually.
1 << 0 is the flag for the first bit
1 << 1 for the second
1 << 2 for the third and so on
I think that’s correct. It’s been years since I’ve used this technique tbh 😅
Which part?