Propeller Manual

Table Of Contents
2: Spin Language Reference – Operators
X := Y -> 5
If Y started out as:
%10000000 01110000 11111111 00110101
...the Bitwise Rotate Right operator would rotate that value right by five bits, moving the
original five LSBs to the five new MSBs, and setting X to:
%10101100 00000011 10000111 11111001
Bitwise Rotate Right has an assignment form,
->=, that uses the variable to its left as both the
first operand and the result destination. For example,
X ->= 3 'Short form of X := X -> 3
Here, the value of X is rotated right three bits and is stored back in X. The assignment form of
Bitwise Rotate Right may also be used within expressions for intermediate results; see
Intermediate Assignments, page 147.
Bitwise Reverse ‘
><’, ‘><=
The Bitwise Reverse operator returns least-significant bits from the first operand in their
reverse order. The total number of least-significant bits to be reversed is indicated by the
second operand. All other bits to the left of the reversed bits are zeros in the result. Bitwise
Reverse can be used in both variable and integer constant expressions, but not in floating-
point constant expressions. Example:
X := Y >< 6
If Y started out as:
%10000000 01110000 11111111 00110101
...the Bitwise Reverse operator would return the six LSBs in reverse order with all other bits
zero, setting
X to:
%00000000 00000000 00000000 00101011
Bitwise Reverse has an assignment form,
><=, that uses the variable to its left as both the first
operand and the result destination. For example,
X ><= 8 'Short form of X := X >< 8
Propeller Manual v1.1 · Page 163