pTAL Reference Manual (H06.08+)

Expressions
HP pTAL Reference Manual523746-006
5-31
Bit Operations
Bit Operations
You can access individual bits or groups of bits in a STRING or INT variable.
Topics:
Bit Extractions on page 5-31
Bit Shifts on page 5-33
Bit Extractions
int-expression
is an INT(32) expression.
left-bit
is an INT constant in the range 0 through 15 that specifies the bit number of either:
The leftmost bit of the bit-extraction field
The only bit (if right-bit is the same value as left-bit or is omitted)
If int-expression is a STRING value, left-bit must be in the range 8
through 15. (In a string value, bit 8 is the leftmost bit and bit 15 is the rightmost bit.)
right-bit
is an INT constant that specifies the rightmost bit of the bit field. If int-
expression is a STRING value, right-bit must be in the range 8 through 15.
right-bit must be equal to or greater than left-bit. To access a single bit,
omit right-bit or specify the same value as left-bit.
Table 5-17. Bit Operations
Bit Operation Description
Extraction Accesses a bit-extraction field in an INT expression without altering the
expression
Deposit Assigns a bit value to a bit-deposit field in a variable
Shift Shifts a bit-shift field in an INT or INT(32) expression to the left or to the
right by a specified number of bits
int-expression
.
<
left-bit
:
right-bit
>
VST016.vsd