Download Function Reference Manual - DSP Development Corporation
Transcript
>> << & ~ bitor (Bit Operators)
Purpose:
Bit left shift, bit right shift, bit and, bit complement, bit or operators.
Format:
<expr1> op <expr2>
<expr1> - Any expression evaluating to a scalar, series, or table.
<expr2> - Any expression evaluating to a scalar, series, or table.
Returns:
A scalar, series, or table.
Example:
W1: {1, 2, 3, 4}
W2: W1 >> 1
returns the series {0, 1, 1, 2}. The bits of each value in the series are shifted one
place to the right resulting in an integer divide by 2.
W3: W1 & 0x01
returns the series {1, 0, 1, 0} indicating the values that have the lowest bit set.
W4: bitor(W1, 0x01)
returns the series {1, 3, 3, 5}.
Remarks:
The following bit operators are supported:
Operator
>>
<<
&
~
Function
Description
BITRSHIFT
BITLSHIFT
BITAND
BITCOMP
BITOR
bit shift right
bit shift left
bit and
bit complement
bit or
The | symbol is not currently used as the BITOR operator since | is the pipe operator.
See Also:
Assignment Operators
Conditional Operators
Logical Operators
17