IAND (The GNU Fortran Compiler)

### 8.146 `IAND` — Bitwise logical and ¶

Synopsis:

  `RESULT = IAND(I, J)`

Description:

  Bitwise logical `AND`.

Class:

  Elemental function

Arguments:

  I | The type shall be `INTEGER`, `UNSIGNED` or a boz-literal-constant.
  J | The type shall be the same type as I with the same kind type parameter or a boz-literal-constant. I and J shall not both be boz-literal-constants.

Return value:

  The return type is with the kind type parameter of the arguments. A boz-literal-constant is converted to an `INTEGER` or `UNSIGNED` with the kind type parameter of the other argument as-if a call to `INT` — Convert to integer type or `UINT` – Convert to `UNSIGNED` type, respectively, occurred.

Example:

      PROGRAM test_iand
        INTEGER :: a, b
        DATA a / Z'F' /, b / Z'3' /
        WRITE (*,*) IAND(a, b)
      END PROGRAM

Specific names:

  Name | Argument | Return type | Standard
  --- | --- | --- | ---
  `IAND(A)` | `INTEGER A` | `INTEGER` | Fortran 90 and later
  `BIAND(A)` | `INTEGER(1) A` | `INTEGER(1)` | GNU extension
  `IIAND(A)` | `INTEGER(2) A` | `INTEGER(2)` | GNU extension
  `JIAND(A)` | `INTEGER(4) A` | `INTEGER(4)` | GNU extension
  `KIAND(A)` | `INTEGER(8) A` | `INTEGER(8)` | GNU extension

Standard:

  Fortran 90 and later, with boz-literal-constant Fortran 2008 and later, has overloads that are GNU extensions. Extension for `UNSIGNED` (see Unsigned integers)

See also:

  `IOR` — Bitwise logical or,
  `IEOR` — Bitwise logical exclusive or,
  `IBITS` — Bit extraction,
  `IBSET` — Set bit,
  `IBCLR` — Clear bit,
  `NOT` — Logical negation