SPL to HP C/XL Migration Guide (30231-90001)
A- 1
Appendix A SPL Procedures to Replace Special Features
The SPL procedures in this appendix perform many of the same operations
as the HP C/XL macros and functions in Appendix B. Using these procedures
in an SPL program will help to isolate special hardware-dependent
operations and greatly simplify the transition to HP C/XL.
SPL BCONCAT Procedure: Bit Concatenation
<< BCONCAT SPL BIT CONCATENATION >>
<< >>
<< This emulates the SPL bit concatenation operation, for example: >>
<< X := A CAT B (4:8:4); >>
<< This procedure performs the same operation without use of >>
<< the CAT operator. >>
<< >>
<< The parameters used by BCONCAT are: >>
<< a -- 1st 16 bit word to be merged into. >>
<< b -- 2nd 16 bit word with field to be merged. >>
<< sa -- Starting bit in word "a". >>
<< sb -- Starting bit in word "b". >>
<< n -- Number of bits to merge. >>
<< >>
<< The 16 bit value returned by the function is the result of >>
<< the concatenate operation. >>
LOGICAL PROCEDURE BCONCAT(a,b,as,bs,n);
VALUE a,b,as,bs,n;
LOGICAL a,b;
INTEGER as,bs,n;
BEGIN
LOGICAL M;
n := 16-n;
M := (%(16)FFFF & LSR(n)) & LSL(n-as);
BCONCAT := (a LAND NOT(M)) LOR
(IF as<bs THEN
b & LSL(bs-as) ELSE
b & LSR(as-bs) LAND M);
END;
SPL BDEPOSIT Procedure: Bit Deposit
<< BDEPOSIT SPL BIT DEPOSIT >>
<< >>
<< This emulates the SPL bit deposit operation, for example: >>
<< I.(5:6) := J + K; >>
<< as an SPL procedure: >>
<< BDEPOSIT(@i,5,6,j+k); >>
<< >>
<< The parameters used by BDEPOSIT are: >>
<< dw -- The address of the destination word. >>
<< sb -- The starting bit of the deposit field. >>
<< nb -- The number of bits to deposit. >>
<< exp -- The expression to deposit into the field specified. >>
<< >>