Next: , Previous: LBOUND, Up: Intrinsic Procedures


7.127 LEADZ — Number of leading zero bits of an integer

Description:
LEADZ returns the number of leading zero bits of an integer.
Standard:
Fortran 2008 and later
Class:
Elemental function
Syntax:
RESULT = LEADZ(I)
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_leadz
            WRITE (*,*) LEADZ(1)  ! prints 8 if BITSIZE(I) has the value 32
          END PROGRAM
     

See also:
BIT_SIZE, TRAILZ