Reference Manual

Turbo PMAC/PMAC2 Software Reference
Turbo PMAC Mathematical Features 488
&
Function: Bit-by-bit and
The & sign implements the bit-by-bit logical and of the numerical value preceding it and the numerical
value following it. A given bit of the result is equal to 1 if and only if the matching bits of both operands
are equal to 1. The operation is done both on integer bits and fractional bits (if any).
Multiplication, division, modulo (remainder), and bit-by-bit and operations have higher priority than
addition, subtraction, bit-by-bit or, and bit-by-bit exclusive-or operations. Operations of the same priority
are implemented from left to right.
This bit-by-bit and operator that logically combines the bits of numerical values is not to be confused with
the AND command, which logically combines conditions.
Execution time, 80 MHz CPU: 3.4 µsec interpreted, 1.4 µsec compiled floating-point, 0.10 µsec compiled
fixed-point
Examples:
Operation
Result
3&1
1
3&2
2
3&3
3
3&4
0
3&-3
1
0.875&1.75
0.75
0.875&-1.75
0.25
|
Function: Bit-by-bit or
The | sign implements the bit-by-bit logical o” of the numerical value preceding it and the numerical
value following it. A given bit of the result is equal to 1 if the matching bit of either operand is equal to
1. The operation is done both on integer bits and fractional bits (if any).
Multiplication, division, modulo (remainder), and bit-by-bit and operations have higher priority than
addition, subtraction, bit-by-bit or, and bit-by-bit exclusive-or operations. Operations of the same priority
are implemented from left to right.
This bit-by-bit or operator that logically combines the bits of numerical values is not to be confused with
the OR command, which logically combines conditions.
Execution time, 80 MHz CPU: 3.2 µsec interpreted, 1.4 µsec compiled floating-point, 0.10 µsec compiled
fixed-point
Examples:
Operation
Result
4|3
7
3|2
3
3|3
3
$F0|$4
$F4
3|-3
-1
0.5|0.375
0.875
0.875|-1.75
-0.375