Condividi tramite


__m64_popcnt

Microsoft Specific

Emits the IPF Population Count instruction (popcnt), which determines the number of set bits (bits with the value 1) in the input 64-bit value.

__m64 __m64_popcnt( 
   __m64 value
);

Parameters

  • [in] value
    An __m64 union whose set bits are to be counted.

Return Value

The number of set (1) bits in the input.

Requirements

Intrinsic

Architecture

__m64_popcnt

IPF

Header file <intrin.h>

Example

// __m64_popcnt.cpp
// processor: IPF

#include <stdio.h>
#include <intrin.h>

#pragma intrinsic(__m64_popcnt)

int main()
{
    __m64 m, result;
    m.m64_i64 = -1;
    result = __m64_popcnt(m);
    printf_s("Population Count of %d (0x%I64x): %I64u\n", 
              m.m64_i64, m.m64_i64, result.m64_i64);

    m.m64_u64 = 0xaaaaaaaaaaaaaaaaI64;
    result = __m64_popcnt(m);
    printf_s("Population Count of %u (0x%I64x): %I64u\n",
              m.m64_u64, m.m64_u64, result.m64_u64);
}
Population Count of -1 (0xffffffffffffffff): 64
Population Count of 2863311530 (0xaaaaaaaaaaaaaaaa): 32

See Also

Reference

__m64

Compiler Intrinsics