3 ms·
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 h
by omegabravo 5y ago
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.
- deleted 5y ago[deleted]
- supermatt 5y ago> 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?