csmg(3I)

CSMG - Performs a conditional scalar merge

As shipped in IRIX 6.5.7. Last changed in IRIX 6.5.5.

NAME
     CSMG - Performs a conditional scalar merge

SYNOPSIS
     CSMG ([I=]i, [J=]j, [K=]k)

IMPLEMENTATION
     UNICOS, UNICOS/mk, IRIX systems

     CF90, MIPSpro 7 Fortran 90

STANDARDS
     Fortran extension

DESCRIPTION
     The CSMG intrinsic function merges i and j, controlled by the bit mask
     in k.  When a 1 bit appears in k, the corresponding bit of i becomes
     the corresponding bit of the result.  When a 0 bit appears in k, the
     corresponding bit of j is taken.  Therefore, CSMG(i, j, k) equals the
     following specification:

          (i .AND. k) .OR. (j .AND. .NOT. k)

     The CSMG function accepts the following arguments:

     i         First item to be merged.  Can be of Boolean, integer, real,
               or Cray pointer type.  Must be the same length as j and k.

     j         Second item to be merged.  Can be of Boolean, integer, real,
               or Cray pointer type.  Must be the same length as i and k.

     k         Bit mask.  Can be of Boolean, integer, real, or Cray pointer
               type.  Must be the same length as i and j.

     CSMG is an elemental function.  The name of this intrinsic cannot be
     passed as an argument.

NOTES
     The CSMG intrinsic function is outmoded.  Refer to the Fortran
     Language Reference Manual, Volume 3, for information on outmoded
     features and their preferred standard alternatives.

RETURN VALUES
     On UNICOS and UNICOS/mk systems, the return value is of type Boolean.
     On IRIX systems, the return value is of type integer.

EXAMPLES
     Example 1:  Specifying CSMG(i,j,MASK(64) or CSMG(i,j,-1) returns i.

     Example 2:  CSMG(i,j,0) returns j.

     Example 3:  Specifying the conditional scalar merge CSMG( 'ABCDEFGH'H,
     '12345678'H, X'0000FFFFFF0000FF' ) generates '12CDE67H'H as the
     result.

     Example 4:  This example applies only to UNICOS systems.

                INTEGER EXPONENT,EXPMASK
                PARAMETER( EXPMASK = X'7FFF000000000000' )
          C Statement function:
                EXPONENT(X) = SHIFTR(X .AND. EXPMASK, 48)
          C Statement function:
                DIVBY2(X) =
              & CSMG( SHIFTL(EXPONENT(X)-1,48),
              &       X,
              &       EXPMASK )

     According to this example, a call to DIVBY2(-28.0) yields -14.0.

SEE ALSO
     Intrinsic Procedures Reference Manual for the printed version of this
     man page.