leadz
returns the number of leading zero bits of an integer.
Fortran 2008 and later
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
bit_size, popcnt, poppar, trailz