- UNIT-I (Array)
strlen(),strcpy(),strcat() ,strcmp()
Definition
Macro substitution directives
File inclusion directives
Conditional compilation
Bitwise Operators
Shift operators
Masks
Bitfield
Macro substitution directives
File inclusion directives
Conditional compilation
Bitwise Operators
Shift operators
Masks
Bitfield
Masks
Masking is the process or operation to set the bit on to off or off to on in a byte, nibble or word.
- Mask means to block.
- Masking is the process by which, only required data is retained and the rest is masked (blocked)
- Masking can be done using Bitwise Operators
- Most Commonly Used Bitwise Operator is AND(&)
A mask defines which bits you want to keep, and which bits you want to clear.
Masking is the act of applying a mask to a value. This is accomplished by doing:
- Bitwise ANDing in order to extract a subset of the bits in the value
- Bitwise ORing in order to set a subset of the bits in the value
- Bitwise XORing in order to toggle a subset of the bits in the value
Below is an example of extracting a subset of the bits in the value:
- Mask: 00001111b
- Value: 01010101b
Applying the mask to the value means that we want to clear the first (higher) 4 bits, and keep the last (lower) 4 bits. Thus we have extracted the lower 4 bits. The result is:
- Mask: 00001111b
- Value: 01010101b
- Result: 00000101b
कोई टिप्पणी नहीं:
एक टिप्पणी भेजें