Csharp/CSharp Tutorial/Operator/Bitwise Operator — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 15:31, 26 мая 2010
Bitwise Compound Assignments
All of the binary bitwise operators can be used in compound assignments.
x = x ^ 127;
x ^= 127;
The Bitwise Operators
- The bitwise operators act directly upon the bits of their operands.
- They are defined only for integer operands.
- They cannot be used on bool, float, or double.
The Bitwise Operators
Operator Result & Bitwise AND | Bitwise OR ^ Bitwise exclusive OR (XOR) > Shift right < Shift left ~ One"s complement (unary NOT) p q p & q p | q p ^ q ~p 0 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 1 0 0