Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "Bitwise math/Operators/OR"

From NetSec
Jump to: navigation, search
 
Line 1: Line 1:
{{subpage|Bitwise math}}
+
<noinclude>{{subpage|Bitwise math}}</noinclude>
 
{{info|<center>'''OR''' will return true bits for the respective placeholder if ''any'' of the bits are true.</center>}}
 
{{info|<center>'''OR''' will return true bits for the respective placeholder if ''any'' of the bits are true.</center>}}
 +
 +
==== OR rules ====
 +
 +
{{:Bitwise math/Operators/OR/rules}}
 +
 +
==== OR properties ====
 +
 +
{{:Bitwise math/Operators/OR/properties}}
 +
 +
==== OR example ====
 +
 +
{{:Bitwise math/Operators/OR/example}}
 +
 +
====OR logic table====
 +
 +
{{:Bitwise math/Operators/OR/logic table}}

Latest revision as of 07:28, 19 July 2012

back to Bitwise math


c3el4.png
OR will return true bits for the respective placeholder if any of the bits are true.

OR rules

OR determines if any bits are true from the given binary operands
  • 1 or 1 = 1
  • 1 or 0 = 1
  • 0 or 0 = 0

OR properties

  • Anything OR'd with itself results in itself
  • Anything OR'd with 0xF results in 0xF
  • Anything OR'd with 0x0 results in itself

OR example

Example: 5 OR C = D
Operation Hexadecimal Binary comment


or

5

C

0101

1100

The second and fourth bits are true.

The first and second bits are true.

=
D 1101 The first, second and fourth bits are true in at least one instance.

OR logic table

OR 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 0 1 2 3 4 5 6 7 8 9 A B C D E F
1 1 1 3 3 5 5 7 7 9 9 B B D D F F
2 2 3 2 3 6 7 6 7 A B A B E F E F
3 3 3 3 3 7 7 7 7 B B B B F F F F
4 4 5 6 7 4 5 6 7 C D E F C D E F
5 5 5 7 7 5 5 7 7 D D F F D D F F
6 6 7 6 7 6 7 6 7 E F E F E F E F
7 7 7 7 7 7 7 7 7 F F F F F F F F
8 8 9 A B C D E F 8 9 A B C D E F
9 9 9 B B D D F F 9 9 B B D D F F
A A B A B E F E F A B A B E F E F
B B B B B F F F F B B B B F F F F
C C D E F C D E F C D E F C D E F
D D D F F D D F F D D F F D D F F
E E F E F E F E F E F E F E F E F
F F F F F F F F F F F F F F F F F