Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: GUID-83EAD758-B832-4A2B-9BD2-144DB1C6EB48
Visible to Intel only — GUID: GUID-83EAD758-B832-4A2B-9BD2-144DB1C6EB48
LEADZ
Elemental Intrinsic Function (Specific): Returns the number of leading zero bits in an integer.
result = LEADZ (i)
i |
(Input) Must be of type integer or logical. |
Results
The result type is default integer. The result value is the number of leading zeros in the binary representation of the integer i.
The model for the interpretation of an integer value as a sequence of bits is shown in Model for Bit Data.
Example
Consider the following:
INTEGER*8 J, TWO PARAMETER (TWO=2) DO J= -1, 40 TYPE *, LEADZ(TWO**J) ! Prints 64 down to 23 (leading zeros) ENDDO END