This is a short tutorial for those needing to know more about how to deal with bit numbers, and masks, and values to use when setting, toggling or clearing bits.
BINARY
Binary numbers, the ones actually used in computers, are made up of "bits". Each bit can only be "on" (1) or "off" (0). So, with one bit you can only count 0 then 1. With 2 bits you can count from 0 to 3, via the combination of the two bits, thus:
00 = 0
01 = 1
10 = 2
11 = 3
A binary number can