Jump to content

Game Development Dictionary


Bitwise Operators


Operators (such as And, Or, Not, and Xor) that do operations on the bits of an integeral type.

Modification by Michael Tanczos

Operations:
A AND B
C/C++ : A & B

Truth Table
-----------
      0  1
    /-----
  0 | 0  0
  1 | 0  1
  
Translation: Yields true if A and B are true

--------------------

A OR B
C/C++ : A | B

Truth Table
-----------
      0  1
    /-----
  0 | 0  1
  1 | 1  1

Translation: Yields true if either A or 
B is true


--------------------

NOT B
C/C++ : ~B
NOT is an operator which negates a bit value

--------------------

A XOR B
C/C++ : A ^ B

Truth Table
-----------
      0  1
    /-----
  0 | 0  1
  1 | 1  0

Translation: Yields true if A and B are different




0 Comments