btest(3I)

BTEST, BITEST, BJTEST, BKTEST - Tests a bit of an integer value

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

NAME
     BTEST, BITEST, BJTEST, BKTEST - Tests a bit of an integer value

SYNOPSIS
     BTEST ([I=]i, [POS=]pos)
     BITEST ([I=]i, [POS=]pos)
     BJTEST ([I=]i, [POS=]pos)
     BKTEST ([I=]i, [POS=]pos)

IMPLEMENTATION
     UNICOS, UNICOS/mk, and IRIX systems

     CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77

STANDARDS
     Fortran

     Fortran extensions:  BITEST, BJTEST, BKTEST

DESCRIPTION
     The BTEST, BITEST, BJTEST, and BKTEST intrinsic functions test a bit
     of an integer value.  They accept the following arguments:

     i         Must be of type integer.  For BITEST, it must be an integer
               (KIND=2) value.  For BJTEST, it must be an integer (KIND=4)
               value.  For BKTEST, it must be an integer (KIND=8) value.

     pos       Must be of type integer.  For BITEST, it must be an integer
               (KIND=2) value.  For BJTEST, it must be an integer (KIND=4)
               value.  For BKTEST, it must be an integer (KIND=8) value.
               It must be nonnegative and be less than BIT_SIZE(i).

     BTEST, BITEST, BJTEST, and BKTEST are elemental functions.  The names
     of these intrinsics cannot be passed as arguments.

RETURN VALUES
     BTEST returns type default logical.  BITEST returns type logical
     (KIND=2).  BJTEST returns type logical (KIND=4).  BKTEST returns type
     logical (KIND=8).

     The result has the value TRUE if bit pos of i has the value 1.  It has
     the value FALSE if bit pos of i has the value 0.  The bit model
     defines the interpretation of an integer value as a sequence of bits.
     This model is described in the MODELS(3I) man page.

EXAMPLES
     Example 1:  BTEST(8,3) has the value TRUE.

     Example 2:  BTEST(8_SHORT,3) has the value TRUE.

     Example 3:  Assume that A has the following value:

     | 1 2 |
     | 3 4 |

     The value of BTEST(A, 2) is as follows:

     | false false |
     | false  true |

     The value of BTEST(2, A) is as follows:

     | true   false |
     | false  false |

SEE ALSO
     MODELS(3I)

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