Hope this makes sense. I understand bitmaps, but I have difficulty in explaining them. (So do I really understand it)
If you have 2 lamps, which condition means that they are both on?
0 & 0 = 0 -- Lamp 1 Off and Lamp 2 Off = No
0 & 1 = 0 -- Lamp 1 Off and Lamp 2 On = No
1 & 0 = 0 -- Lamp 1 On and Lamp 2 Off = No
1 & 1 = 1 -- Lamp 1 On and Lamp 2 On = Yes
Considder an 8 bit binary bitmap
All bits off = 00000000 = 0
All bits on = 11111111 = 255 (2^0 + 2^1 + 2^2 + 2^3 + 2^4 + 2^5 + 2^6 + 2^7)
Lets look at 10 & 2
00001010 (10)
00000010 ( 2)
BINARY AND 00000010 = ( 2)
Now lets look at 11 & 9
00001011 (11)
00001001 ( 9)
BINARY AND 00001001 = ( 9)
Now lets look at 11 & 3
00001011 (11)
00000011 ( 3)
BINARY AND 00000011 = ( 3)
Now, lets look at 255 & 32
11111111
00100000
BINARY AND 00100000 = 32
Now, lets look at 255 & 33
11111111
00100001
BINARY AND 00100001 = 33