TAL Reference Manual
Expressions
TAL Reference Manual—526371-001
4-29
Bit Shifts
2. This example assigns bits <4:7> of the sum of two numbers to RESULT. The 
parentheses cause the numbers to be added before the bits are extracted:
INT result;
INT num1 := 51;
INT num2 := 28;
result := (num1 + num2).<4:7>;
3. This conditional expression checks bit <15> for a nonzero value:
STRING var;
IF var.<15> THEN ... ;
Bit Shifts
A bit shift operation shifts a bit field a specified number of positions to the left or to the 
right within a variable without altering the variable.
int-expression
is an INT arithmetic expression. int-expression can contain STRING, INT, or 
UNSIGNED(1–16) operands. The bit shift occurs within a word.
dbl-expression
is an INT(32) arithmetic expression. dbl-expression can contain INT(32) or 
UNSIGNED(17–31) operands. The bit shift occurs within a doubleword.
shift-operator
is one of the operators ('<<', '>>', <<, >>) described in Table 4-14. 
positions
is an INT expression that specifies the number of bit positions to shift the bit field. 
A value greater than 31 gives undefined results (different on TNS and TNS/R 
systems).
VST0410.vsd
int-expression
dbl-expression
positionsshift-operator










