TAL Programmer's Guide

Accessing Operands
Using Expressions
096254 Tandem Computers Incorporated 5–31
You can shift the right byte of a word into the left byte and set the right byte to zero:
INT b; !Declare variable
b := b '<<' 8; !Shift right byte into left
! byte, leaving zero in
! right byte
The following 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
The following 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
The following signed left shift shows how zeros fill the vacated bits from the right,
while the sign bit remains the same (TNS systems only):
Initial value = 1 011 101 010 100 000
<< 1 = 1 111 010 101 000 000
The following signed right shift shows how the sign bit fills the vacated bits from the
left:
Initial value = 1 111 010 101 000 000
>> 3 = 1 111 111 010 101 000