Guardian Application Conversion Guide

General-Case Variances
Converting to TNS/R Systems
9–8 096047 Tandem Computers Incorporated
For double-word shift operations with dynamic shift counts:
TNS systems accept counts within the range of 0 to 255. Shift counts of 32 to 255
are treated as 32.
TNS/R systems accept counts within the range of 0 to 32,767. Shift counts greater
than 32 are treated as 32.
Dynamic shift counts that fall outside of the acceptable ranges give undefined results.
The ALS, LLS, ARS, and LRS instructions implement single-word shifts and the DALS,
DLLS, DARS, and DLRS instructions implement double-word shifts.
The TAL compiler generates these instructions for the bit-shift operators ('<<', '>>', <<,
and >>) if the operand to the right of the operators is not a constant. These
instructions can also be found in TAL CODE statements. Refer to the appropriate
system description manual for more information about the TNS instruction set. Refer
to the TAL Reference Manual for details on TAL bit-shift operators.
To correct your program, you must recode statements that use dynamic shift counts
greater than 31. Use a text editor to search for “ALS 0”, “LLS 0”, “ARS 0”, and “LRS 0”
in TAL CODE statements. Make sure that the operands for these instructions do not
use shift counts greater than 31. Also search for the TAL bit-shift operators: unsigned
left and right shift ('<<' and '>>') and signed left and right shift (<< and >>). Make
sure that in cases where the left operand is a 16-bit unit and the shift count is dynamic,
the count is never greater than 31.
In the following example, the value of p is arithmetically shifted to the right 35
positions. The value of differs on TNS and TNS/R systems.
INT p, nbits, q; ! INT variables
p := -128;
nbits := 35; ! Shift value of 35-bits
q := p >> nbits; ! On TNS systems,
! same as p >> 16, q = -1
! On TNS/R systems,
! same as p >> (35-32), q = -16