summaryrefslogtreecommitdiff
path: root/numpy/distutils/checks/cpu_popcnt.c
blob: e6a80fb40be47b5c38d487dfc8a3c5b196d2237b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifdef _MSC_VER
    #include <nmmintrin.h>
#else
    #include <popcntintrin.h>
#endif

int main(void)
{
    long long a = 0;
    int b;
#ifdef _MSC_VER
    #ifdef _M_X64
    a = _mm_popcnt_u64(1);
    #endif
    b = _mm_popcnt_u32(1);
#else
    #ifdef __x86_64__
    a = __builtin_popcountll(1);
    #endif
    b = __builtin_popcount(1);
#endif
    return (int)a + b;
}