trailz
- Date:
06-19-2023
NAME
TRAILZ - Count the number of trailing zero bits in an integer
SYNOPSIS
Fortran Synopsis
INTEGER FUNCTION TRAILZ ( [I=]I )
INTEGER I
STANDARDS
Fortran 2008
DESCRIPTION
This intrinsic function counts the number of trailing zero bits in i.
Fortran
TRAILZ accepts argument i, which is a logical, integer, real, or Cray pointer value. Argument i cannot be declared as REAL(KIND=16).
TRAILZ is an elemental function. The name of this function cannot be passed as an argument.
RETURN VALUES
Fortran
TRAILZ returns a default integer.
EXAMPLES
The following lines of Fortran code shows the TRAILZ function used with an argument of type integer. The bit pattern of the argument and the value of the result are also given. For simplicity, a 64-bit object is used:
INTEGER (KIND=8) I1, I2
I2 = TRAILZ(I1)
-----------------------------------------------------------------
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | . . . | 1 | 1 | 1 | 0 | 1 | 0 | 0 |
-----------------------------------------------------------------
I1
TRAILZ returns 2 for integer variable I2.
SEE ALSO
leadz(3i)