HP 3000 Manuals

HP C/XL BDEPOSIT Function: Bit Deposit [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation


SPL to HP C/XL Migration Guide

HP C/XL BDEPOSIT Function:  Bit Deposit 

     /**************************************************************
       BDEPOSIT          SPL BIT DEPOSIT

       This emulates the SPL bit deposit operation, for example,
                I.(5:6) := J + K;
       Using this function, this may be converted to HP C with:
                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.
     ***************************************************************/

     void BDEPOSIT(dw,sb,nb,exp)
     unsigned short *dw, sb, nb, exp;
     {
       unsigned short m;
       nb = 16-nb;
       sb = nb-sb;
       m = (0xFFFF>>nb)<<sb;
       *dw = (*dw & ~m) | (exp<<sb & m);
     }



MPE/iX 5.0 Documentation