Hacker News new | past | comments | ask | show | jobs | submit login

the wiki is a visual representation. The representation is 0s and 1s.

The use case for bitwise operations is to control the value of 1 bit.

Consider if you have a 0000 1000 value. It's mapped to hardware output so the 4th LED is on. Now you want to turn the 5th on, and the 4th off. You would use a left shift so the output becomes 0001 0000.

That's all there is to it. Bitwise operators operate on bits, not bytes. Because computers operate on bytes, and you can't address a bit - you have to modify bytes to accomplish your goal.




> Bitwise operators operate on bits, not bytes. Because computers operate on bytes, and you can't address a bit - you have to modify bytes to accomplish your goal.

I think this may be the fundamental intent I was missing. How do people wrangle these things in their head! Is it ever intuitive, or are even the proficient externally visualising this stuff in some way?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: