TAL Reference Manual
Expressions
TAL Reference Manual—526371-001
4-28
Bit Extractions
Bit Extractions
A bit extraction lets you access a bit field in an INT expression without altering the
expression.
int-expression
is an INT expression (which can include STRING, INT, or UNSIGNED(1–16)
values).
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.
Usage Considerations
Specify the bit-extraction format with no intervening spaces, as in:
myvar.<0:5>
Examples of Bit Extractions
1. This assignment accesses bits in an array element:
STRING right_byte;
INT array[0:7];
right_byte := array[5].<8:15>;
VST0409.vsd
int-expression left-bit
.
<
>
:
right-bit
ns
nsnsns
nsns