Csharp/CSharp Tutorial/Operator/Bitwise Operator — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:16, 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

  1. The bitwise operators act directly upon the bits of their operands.
  2. They are defined only for integer operands.
  3. 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