Esta documentación está archivada y no tiene mantenimiento.


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

[in] value

An __m64 union whose set bits are to be counted.

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





Header file <intrin.h>

// __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