Description
The compound bitwise AND operator &=
is often used with a variable and a constant to force particular bits in a variable to the LOW state (to 0). This is often referred to in programming guides as "clearing" or "resetting" bits.
A review of the Bitwise AND &
operator:
0 0 1 1 operand1 0 1 0 1 operand2 ---------- 0 0 0 1 (operand1 & operand2) - returned result
Syntax
x &= y; // equivalent to x = x & y;
Parameters
x
: variable. Allowed data types: char
, int
, long
.
y
: variable or constant. Allowed data types: char
, int
, long
.