![]() |
![]() |
![]() |
![]() |
![]() |
|
Next, you need to know about the
bitwise or operator, |.
Given 2 bytes as operands in a bitwise-or expression, the value produced is
a byte whose bits are 1 in exactly those positions where one or both
operands have a 1:
*-*-*-*-*-*-*-*-*
|0|0|0|0|0|0|0|0| ----*
*-*-*-*-*-*-*-*-* |
v Combine with 1 using bitwise-or operator
*-*-*-*-*-*-*-*-* |
|0|0|0|0|0|0|0|1| -->-|
*-*-*-*-*-*-*-*-* |
v
*-*-*-*-*-*-*-*-* |
|0|0|0|0|0|0|0|1| <--* --*
*-*-*-*-*-*-*-*-* |
v Combine with 1 using bitwise-or operator
*-*-*-*-*-*-*-*-* |
|0|0|0|0|0|0|0|1| ----->---|
*-*-*-*-*-*-*-*-* |
v
*-*-*-*-*-*-*-*-* |
|0|0|0|0|0|0|0|1| <--------* --*
*-*-*-*-*-*-*-*-* |
v Combine with 8 using bitwise-or
*-*-*-*-*-*-*-*-* | operator
|0|0|0|0|0|1|0|0| ----->-------|
*-*-*-*-*-*-*-*-* |
v
*-*-*-*-*-*-*-*-* |
|0|0|0|0|0|1|0|1| <------------*
*-*-*-*-*-*-*-*-*