![]() |
<< Index >> |
FutureBasic 5 |
xor | operator | |
|
result = exprA {xor | ^^} exprB
exprA
and expression exprB
are each interpreted as 32-bit integer quantities. The xor
operator performs a "bitwise comparison" of each bit in exprA
with the bit in the corresponding posistion in exprB
. The result
is another 32-bit quantity; each bit in the result is determined as follows:Bit value in expr | Bit value in expr | Bit value in result |
0 | 0 | 0 |
1 | 0 | 1 |
0 | 1 | 1 |
1 | 1 | 0 |
xor
is to toggle the state of individual bits in a bit pattern. For example: pattern = pattern xor bit(7)
pattern
from 0 to 1 or from 1 to 0, and leaves all of pattern's
other bits alone.xor
:defstr long
print bin$(923)
print bin$(123)
print "--------------------------------"
print bin$(923 xor 123)
00000000000000000000001110011011
00000000000000000000000001111011
--------------------------------
00000000000000000000001111100000