TAL Reference Manual
Expressions
TAL Reference Manual—526371-001
4-30
Usage Considerations
Usage Considerations
Table 4-14 lists the bit-shift operators you can specify.
For signed left shifts (<<), programs that run on TNS/R systems use unsigned left shifts
('<<').
Bit-shift operations include:
Examples of Bit Shifts
1. This unsigned left shift shows how zeros fill the vacated bits from the right:
Initial value = 0 010 111 010 101 000
'<<' 2 = 1 011 101 010 100 000
2. This unsigned right shift shows how zeros fill the vacated bits from the left:
Initial value = 1 111 111 010 101 000
'>>' 2 = 0 011 111 110 101 010
Table 4-14. Bit-Shift Operators
Operator Function Result
‘<<‘ Unsigned left shift through
bit <0>
Zeros fill vacated bits from the right
‘>>’ Unsigned right shift Zeros fill vacated bits from the left.
<< Signed left shift through
bit <0> or bit <1>
Zeros fill vacated bits from the right. In
arithmetic overflow cases, the final value of bit
<0> is undefined (different for TNS/R
accelerated mode than for TNS systems).
>> Signed right shift Sign bit (bit <0>) unchanged; sign bit fills
vacated bits from the left
Operation User Action
Multiplication by powers of 2 For each power of 2, shift the field one bit to the left.
(Some data might be lost.)
Division by powers of 2 For each power of 2, shift the field one bit to the right
(Some data might be lost.)
Word-to-byte address conversion Shift the word address one bit to the left, using an
unsigned shift operator.