Right Click to Search

Saturday, February 6, 2025

Bitwise Operations and Masking



Bitwise Operations and Masking in C Programming

  1. Mask means to block.
  2. Masking is the process by which , only required data is retained and the rest is masked (blocked)
  3. Masking can be done using Bitwise Operators
  4. Most Commonly Used Bitwise Operator is AND(&)
Process of Masking :We want Last 4 LSB Bits , So Mask it with (0000 0000 0000 1111)
Num 1 : 1000 0001 1110 1011
& : 0000 0000 0000 1111

We get Result as :-
Num 1 : 0000 0000 0000 1011  // First 12 bits are Masked
Thus ....
  1. Portion to be retained is ANDed with 1 
  2. Portion to be Masked is ANDed with 0



Bookmark & Share

Tags / Keywords : | , ,

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates