leadz(3f) - [FORTRAN:INTRINSIC:BIT INQUIRY] Number of leading zero bits of an integer
Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also
result = leadz(i)
LEADZ returns the number of leading zero bits of an integer.
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).
Sample program:
program demo_leadz write (*,*) leadz(1) ! prints 8 if bitsize(i) has the value 32 end program demo_leadz
[[Fortran 2008]] and later
[[Elemental procedure|Elemental function]]
[[bit_size]], [[popcnt]], [[poppar]], [[trailz]]
leadz (3) | March 18, 2019 |