Propeller Manual

Table Of Contents
Operators – Spin Language Reference
Table 2-13: Bitwise XOR Truth Table
Bit States Result
0 0 0
0 1 1
1 0 1
1 1 0
Example:
X := %00101100 ^ %00001111
The above example XORs %00101100 with %00001111 and writes the result, %00100011,
to
X.
Bitwise XOR has an assignment form,
^=, that uses the variable to its left as both the first
operand and the result destination. For example,
X ^= $F 'Short form of X := X ^ $F
Here, the value of X is XORed with $F and the result is stored back in X. The assignment
form of Bitwise XOR may also be used within expressions for intermediate results; see
Intermediate Assignments, page 147.
Bitwise NOT ‘
!
The Bitwise NOT ‘
!’ operator performs a bitwise NOT (inverse, or one’s-complement) of the
bits of the operand that follows it. Bitwise NOT can be used in both variable and integer
constant expressions, but not in floating-point constant expressions.
Each bit of the two operands is subject to the following logic:
Table 2-14: Bitwise NOT Truth Table
Bit State Result
0 1
1 0
Example:
X := !%00101100
Page 166 · Propeller Manual v1.1