Complete the code to clear bit 3 of the variable reg.
reg = reg & [1];To clear bit 3, we use bitwise AND with the complement of (1 shifted left by 3).
Complete the code to clear the bit specified by bit_pos in reg.
reg &= [1];To clear a bit at position bit_pos, AND with the complement of (1 shifted left by bit_pos).
Fix the error in the code that attempts to clear bit 2 of reg.
reg = reg & [1];The mask must be the complement of (1 shifted left by 2) to clear bit 2 correctly.
Fill both blanks to clear bit 5 in reg using a mask.
unsigned int mask = [1]; reg = reg & [2];
Create the mask by shifting 1 left by 5, then clear bit 5 by ANDing reg with the complement of the mask.
Fill all three blanks to clear the bit at position pos in reg using a mask variable.
unsigned int mask = [1]; unsigned int inv_mask = [2]; reg = reg [3] inv_mask;
Create the mask by shifting 1 left by pos, invert it to get inv_mask, then clear the bit by ANDing reg with inv_mask.