If you do you will get a very wonderful 10 points as you are helping me in my BTEC Diploma ICT assignment.Can anyone explain to me what bit masks and bit maps are in computing?
Bit Mask is used when you only want to look at some of the bits in a byte (or integer or whatever). for example, you have a byte (8 bits) where only the first 4 bits have a meaning, like the status of an operational mode.
bit0 = off
bit1 = standby
bit2 = operational
bit3 = error
the other 4 bits are undefined and can be anything.
to get the mode of operation, you want to mask off the upper 4 bits by creating a bit mask.
#define STATUS_MASK 0x0f
to use the mask, read in the status byte then ';AND'; it with the mask, and what is left is the lower 4 bytes showing the status.
Status = Op_Status %26amp; STATUS_MASK
the upper 4 bytes will all be 0.
Bit Map is used to store the color information for an image. each pixel is represented by 4 bytes. 3 of the 4 bytes store the Red, Blue, and Green, intensity. Not sure what the 4th byte is used for.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment