+-------------------------------IBM Extension--------------------------------+

POPCNT(I)

Purpose

Population count.

Counts the number of set bits in a data object.

Class

Elemental function.

Argument Type and Attributes

I
An INTENT(IN) argument of type BYTE, INTEGER, LOGICAL, or REAL. If the argument is of type REAL, it must not be REAL(16).

Result Type and Attributes

Default integer.

Result Value

The number of bits set to ON or 1.

Examples


INTEGER BIT REPRESENTATION POPCNT
0 0000 0
1 0001 1
2 0010 1
3 0011 2
4 0100 1

Related Information

Data Representation Models

+----------------------------End of IBM Extension----------------------------+

IBM Copyright 2003