bitwise OR
Bitwise OR is a bit-level operation on two binary values which indicates which bits are set in either value. For each position i, if the bit di in either value is 1, then di of the result is 1, otherwise itβs 0. For example, given 50 and 163 in two unsigned bytes, a bitwise OR returns 179.
0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | |
OR | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
---|---|---|---|---|---|---|---|---|
= | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |
In most high-level programming languages that offer bitwise OR, the usual operator is a single pipe line (β), not to be confused with a double pipe line (ββ) which performs a Boolean OR, returning a True or False value.
The Windows Calculator offers bitwise OR in scientific calculator mode, while the Mac OS X Calculator offers it in programmer mode.
Title | bitwise OR |
---|---|
Canonical name | BitwiseOR |
Date of creation | 2013-03-22 17:02:48 |
Last modified on | 2013-03-22 17:02:48 |
Owner | PrimeFan (13766) |
Last modified by | PrimeFan (13766) |
Numerical id | 4 |
Author | PrimeFan (13766) |
Entry type | Definition |
Classification | msc 11A63 |
Related topic | BitwiseAND |
Related topic | BitwiseXOR |
Related topic | BitwiseNOT |