SPL to HP C/XL Migration Guide (30231-90001)

5-7
See "Procedure Call Statement" and "Data Type" for more details about
parameters passed by reference.
Bit Operations
Table 5-10. Bit Operations
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| Bit operations can be used in any | Standard operators handle much of the bit |
| expression. They include bit extraction, | shifting and logical masking. Bit |
| bit concatenation or deposit, bit shifting, | extraction, concatenation, and some other |
| and logical masking. | manipulations will require user-supplied |
| | functions or #define directives. |
| | |
---------------------------------------------------------------------------------------------
Bit operations are commonly used in the limited-space MPE V system to
conserve space. With the increased memory of the MPE XL system, it may
be more efficient to rewrite bit operations to use full words, resulting
in both improved performance and a much more portable program.
NOTE While a simple BYTE variable is
stored
in bits 0-7 of a 16-bit
word, the bits are
referenced
in bit operations as 8-15.
Table 5-11 summarizes all the HP C/XL bitwise operators.
Table 5-11. HP C/XL Bit Operators
---------------------------------------------------------------------------------------------
| | |
| Operator | Operation |
| | |
---------------------------------------------------------------------------------------------
| | |
|
op1
&
op2
| bitwise AND of
op1
and
op2
|
| | |
---------------------------------------------------------------------------------------------
| | |
|
op1
|
op2
| bitwise inclusive OR of
op1
and
op2
|
| | |
---------------------------------------------------------------------------------------------
| | |
|
op1
^
op2
| bitwise exclusive OR of
op1
and
op2
|
| | |
---------------------------------------------------------------------------------------------
| | |
|
op1
<<
op2
| shift
op1
left
op2
bits |
| | |
---------------------------------------------------------------------------------------------
| | |
|
op1
>>
op2
| shift
op1
right
op2
bits |
| | |
---------------------------------------------------------------------------------------------
| | |
| ~
op2
| bitwise negation of
op2
|
| | |
---------------------------------------------------------------------------------------------