popcnt(3I)

_popcnt, POPCNT - Counts number of set bits

As shipped in IRIX 6.5.5. Last changed in IRIX 6.5.5.

NAME
     _popcnt, POPCNT - Counts number of set bits

SYNOPSIS
     C/C++:

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

     Fortran:

     POPCNT ([I=]i)

IMPLEMENTATION
     C/C++:  UNICOS and UNICOS/mk systems

     Fortran:  UNICOS, UNICOS/mk, IRIX systems

     Cray C/C++, CF90, MIPSpro 7 Fortran 90

STANDARDS
     C/C++ extension

     Fortran extension

DESCRIPTION
   C/C++
     The _popcnt function returns the number of bits set to 1 (the
     population count) in argument i.

   Fortran
     This intrinsic function counts the number of bits set in the argument.
     It accepts the following argument:

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

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

NOTES
     A vector version of the POPCNT intrinsic function exists on UNICOS and
     UNICOS/mk systems.  On UNICOS/mk systems, the vector version of this
     intrinsic is used when -O vector3 or -O 3 are specified on the
     compiler command line.

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

   Fortran
     The bit representation of the logical data type is not consistent
     among UNICOS and UNICOS/mk systems.  For further details, see your
     compiler's reference manuals.

FORTRAN RETURN VALUES
     POPCNT returns a value of type integer.

EXAMPLES
     Fortran: The following section of Fortran code shows the POPCNT
     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 = POPCNT(I1)


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

     The POPCNT function returns the value 6 to the integer variable I2.

SEE ALSO
     A complete list of C/C++ intrinsic functions available on UNICOS and
     UNICOS/mk systems is in the Cray C/C++ Reference Manual.

     Intrinsic Procedures Reference Manual for the printed version of this
     man page.