Possible Duplicate:
Bitwise Operation and Usage
x is the input. need to put either 0, 1, x, or x̅ :
x & 0 = 0
x & 1 = x
x | 0 = x
x | 1 = 0
x ^ 0 = 1
x ^ 1 =
Possible Duplicate:
Bitwise Operation and Usage
x is the input. need to put either 0, 1, x, or x̅ :
x & 0 = 0
x & 1 = x
x | 0 = x
x | 1 = 0
x ^ 0 = 1
x ^ 1 =
If x
is a boolean, then !x
is the boolean negation of x. That's your 'flip'.
For turn on and turn off, just do x = 1
and x = 0
x & 0 = 0
x & 1 = x
x | 0 = x
x | 1 = 1
x ^ 0 = x
x ^ 1 = 0 if x is 1, 1 if x is 0