summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/distutils/checks/cpu_popcnt.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/numpy/distutils/checks/cpu_popcnt.c b/numpy/distutils/checks/cpu_popcnt.c
index e6a80fb40..f6c785dd2 100644
--- a/numpy/distutils/checks/cpu_popcnt.c
+++ b/numpy/distutils/checks/cpu_popcnt.c
@@ -4,20 +4,26 @@
#include <popcntintrin.h>
#endif
+#include <stdlib.h>
+
int main(void)
{
long long a = 0;
int b;
+
+ a = random();
+ b = random();
+
#ifdef _MSC_VER
#ifdef _M_X64
- a = _mm_popcnt_u64(1);
+ a = _mm_popcnt_u64(a);
#endif
- b = _mm_popcnt_u32(1);
+ b = _mm_popcnt_u32(b);
#else
#ifdef __x86_64__
- a = __builtin_popcountll(1);
+ a = __builtin_popcountll(a);
#endif
- b = __builtin_popcount(1);
+ b = __builtin_popcount(b);
#endif
return (int)a + b;
}