TRAILZ (The GNU Fortran Compiler)

### 8.288 `TRAILZ` — Number of trailing zero bits of an integer ¶

Synopsis:

  `RESULT = TRAILZ(I)`

Description:

  `TRAILZ` returns the number of trailing zero bits of an integer.

Class:

  Elemental function

Arguments:

  I | Shall be of type `INTEGER`.

Return value:

  The type of the return value is the default `INTEGER`. If all the bits of `I` are zero, the result value is `BIT_SIZE(I)`.

Example:

      PROGRAM test_trailz
        WRITE (*,*) TRAILZ(8)  ! prints 3
      END PROGRAM

Standard:

  Fortran 2008 and later

See also:

  `BIT_SIZE` — Bit size inquiry function,
  `LEADZ` — Number of leading zero bits of an integer,
  `POPPAR` — Parity of the number of bits set,
  `POPCNT` — Number of bits set