English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

If you do you will get a very wonderful 10 points as you are helping me in my BTEC Diploma ICT assignment.

2007-01-09 08:45:31 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

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 & 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.

2007-01-10 01:21:53 · answer #1 · answered by justme 7 · 0 0

fedest.com, questions and answers