HP 3000 Manuals

SPL BCONCAT Procedure: Bit Concatenation [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation


SPL to HP C/XL Migration Guide

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;



MPE/iX 5.0 Documentation