Bit Masking: A Practical Example
How to store data on teeny-tiny bits
All your base are belong to us
If you're a programmer, you may already have some notions of numeral systems and you've interacted with a couple of them.
If not, then it'll be a bit harder to feel at home going forward and it may help to get familiar:
For understanding the following example, it is very important to understand the binary system and its operators. In it, we’ll use only the & (AND) and ^ (XOR) operators. AND will be used to determine whether a particular bit is 1 or 0. XOR will be used to switch particular bits between 1 and 0.
There are 10 types of people in this world, those who understand binary and those who don’t.
The practical example
Our computers work with the binary system and that means that the digits that can be used at any given position are either 0 or 1.