Showing changes from revision #1 to #2:
Added | Removed | Changed
leadz returns the number of leading zero bits of an integer.
Fortran 2008 and laterFortran 2008 and later
Elemental functionElemental 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 (*,*) leadz(1) ! prints 8 if bitsize(i) has the value 32
end program