pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Table 39 Bit Operations
DescriptionBit Operation
Accesses a bit-extraction field in an INT expression without altering the expressionExtraction
Assigns a bit value to a bit-deposit field in a variableDeposit
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
Shift
Topics:
Bit Extractions (page 93)
Bit Shifts (page 94)
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.
You can perform bit extractions and deposits on 16-bit and 32-bit items. pTAL reports an error,
however, if you attempt to reference bits outside of the bits declared in the variable’s declaration.
Bit Operations 93