ibchng(3I)

IBCHNG, IIBCHNG, JIBCHNG, KIBCHNG, IBCLR, IIBCLR, JIBCLR, KIBCLR, IBSET, IIBSET, JIBSET, KIBSET - Sets, clears, or reverses the value of a specified bit in an integer

Showing IRIX 6.5.30 (default release). Last changed in IRIX 6.5.19.

NAME
     IBCHNG, IIBCHNG, JIBCHNG, KIBCHNG, IBCLR, IIBCLR, JIBCLR, KIBCLR,
     IBSET, IIBSET, JIBSET, KIBSET - Sets, clears, or reverses the value of
     a specified bit in an integer

SYNOPSIS
     IBCHNG ([I=]i, [POS=]pos)
     IIBCHNG ([I=]i, [POS=]pos)
     JIBCHNG ([I=]i, [POS=]pos)
     KIBCHNG ([I=]i, [POS=]pos)

     IBCLR ([I=]i, [POS=]pos)
     IIBCLR ([I=]i, [POS=]pos)
     JIBCLR ([I=]i, [POS=]pos)
     KIBCLR ([I=]i, [POS=]pos)

     IBSET ([I=]i, [POS=]pos)
     IIBSET ([I=]i, [POS=]pos)
     JIBSET ([I=]i, [POS=]pos)
     KIBSET ([I=]i, [POS=]pos)

STANDARDS
     Fortran

     Fortran extensions:  IBCHNG, IIBCHNG, JIBCHNG, KIBCHNG, IIBCLR,
     JIBCLR, KIBCLR, IIBSET, JIBSET, KIBSET

DESCRIPTION
     The IBCHNG, IIBCHNG, JIBCHNG, and KIBCHNG intrinsic functions reverse
     the value of a specified bit in an integer.

     The IBCLR, IIBCLR, JIBCLR, and KIBCLR intrinsic functions clear one
     bit to zero.

     The IBSET, IIBSET, JIBSET, and KIBSET intrinsic functions set one bit
     to 1.

     They accept the following arguments:

     i         Must of of type integer.

               For IBCHNG, IIBCHNG, JIBCHNG, and KIBCHNG, i contains the
               bit to be reversed.  For IIBCHNG, must be of type integer
               (KIND=2).  For JIBCHNG, must be of type integer (KIND=4).
               For KIBCHNG, must be of type integer (KIND=8).

               For IIBCLR, must be of type integer (KIND=2).  For JIBCLR,
               must be of type integer (KIND=4).  For KIBCLR, must be of
               type integer (KIND=8).

               For IIBSET, must be of type integer (KIND=2).  For JIBSET,
               must be of type integer (KIND=4).  For KIBSET, must be of
               type integer (KIND=8).

     pos       Must be of type integer.

               For IBCHNG, IIBCHNG, JIBCHNG, and KIBCHNG, i specifies the
               position of the bit to be reversed.  The rightmost (least
               significant) bit of i is in position 0.

               For IBCLR, IIBCLR, JIBCLR, KIBCLR, IBSET, IIBSET, JIBSET,
               and KIBSET, pos must be nonnegative and less than BIT_SIZE
               (i).

     These are elemental intrinsic functions.  The names of these
     intrinsics cannot be passed as arguments.

RETURN VALUES
     For IBCHNG, IIBCHNG, JIBCHNG, and KIBCHNG, the result type and type
     parameter are the same as i.  The result is equal to i, with the bit
     in position pos reversed.

     For IBCLR, IIBCLR, JIBCLR, and KIBCLR, The result type and type
     parameter are the same as i.  The result has the value of the sequence
     of bits of i, except that bit pos of i is set to zero.

     For IBSET, IIBSET, JIBSET, KIBSET, The result type and type parameter
     are the same as i.  The result has the value of the sequence of bits
     of i, except that bit pos of i is set to one.

     The bit model defines the interpretation of an integer value as a
     sequence of bits.  For more information on the bit model, see the
     MODELS(3I) man page.

EXAMPLES
     Example 1.  IBCLR(14,1) yields 12.

     Example 2.  If V has the value [1,2,3,4], IBCLR(POS=V,I=31) yields
     [29,27,23,15].

     Example 3.  IBSET(12,1) yields 14.

     Example 4.  If V has the value [1,2,3,4], IBSET(POS=V,I=0) yields
     [2,4,8,16].

SEE ALSO
     MODELS(3I)