leadz(3I)

_leadz, LEADZ - Counts number of leading 0 bits

Showing IRIX 6.5.30 (default release). Last changed in IRIX 6.5.19.

NAME
     _leadz, LEADZ - Counts number of leading 0 bits

SYNOPSIS
     C/C++

     #include <intrinsics.h>
     int _leadz (long i)

     Fortran:

     LEADZ ([I=]i)

STANDARDS
     C/C++ extension

     Fortran extension

DESCRIPTION
     This intrinsic function counts the number of leading 0 bits in i.

NOTES
   C/C++
     Because _leadz is an intrinsic function, no externally visible library
     function is available for it.  The compiler generates inline code to
     produce the result.

   Fortran
     LEADZ accepts the following argument:

     i    A Boolean, integer, real, or Cray pointer value.  i cannot be
          declared as REAL(KIND=16).

     LEADZ is an elemental function.  The name of this function cannot be
     passed as an argument.

FORTRAN RETURN VALUES
     LEADZ returns a value of type default integer.

EXAMPLES
     The following section of Fortran code shows the LEADZ function used
     with an argument of type integer.  The bit pattern of the argument and
     the value of the result are also given.  For simplicity, a 16-bit
     object is used.

          INTEGER I1, I2
          ...
          I2 = LEADZ(I1)


           ---------------------------------------------------------------
          | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 |
           ---------------------------------------------------------------
                                        I1

     LEADZ returns 5 for the integer variable I2.