Next: LEN, Previous: LCOBOUND, Up: Intrinsic Procedures [Contents][Index]
LEADZ
— Number of leading zero bits of an integerLEADZ
returns the number of leading zero bits of an integer.
Fortran 2008 and later
Elemental function
RESULT = LEADZ(I)
I | Shall be of type INTEGER . |
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)
.
PROGRAM test_leadz WRITE (*,*) BIT_SIZE(1) ! prints 32 WRITE (*,*) LEADZ(1) ! prints 31 END PROGRAM