[UP]


Manual Reference Pages  - popcnt (3)

NAME

popcnt(3f) - [FORTRAN:INTRINSIC:BIT INQUIRY] Number of bits set

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class
See Also

SYNTAX

result = popcnt(i)

DESCRIPTION

Returns the number of bits set in the binary representation of an integer.

ARGUMENTS

I - Shall be of type INTEGER.

RETURN VALUE

The return value is of type ’integer’ and of the default integer kind.

EXAMPLE

Sample program:

   program demo_population
     print *, popcnt(127),       poppar(127)
     print *, popcnt(huge(0_4)), poppar(huge(0_4))
     print *, popcnt(huge(0_8)), poppar(huge(0_8))
   end program demo_population

STANDARD

[[Fortran 2008]] and later

CLASS

[[Elemental function]]

SEE ALSO

[[poppar]], [[leadz]], [[trailz]]


popcnt (3) March 19, 2019
Generated by manServer 1.08 from a75705ef-aad0-4268-980c-6c199b544d49 using man macros.