mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2026-01-02 06:34:41 +03:00
remove Windows/ICC support
This commit is contained in:
@@ -38,36 +38,38 @@
|
||||
|
||||
static really_inline
|
||||
u32 popcount32(u32 x) {
|
||||
#if defined(HAVE_POPCOUNT_INSTR)
|
||||
// Single-instruction builtin.
|
||||
return _mm_popcnt_u32(x);
|
||||
#else
|
||||
// Fast branch-free version from bit-twiddling hacks as older Intel
|
||||
// processors do not have a POPCNT instruction.
|
||||
x -= (x >> 1) & 0x55555555;
|
||||
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||||
return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
|
||||
#endif
|
||||
return __builtin_popcount(x);
|
||||
// #if defined(HAVE_POPCOUNT_INSTR)
|
||||
// // Single-instruction builtin.
|
||||
// return _mm_popcnt_u32(x);
|
||||
// #else
|
||||
// // Fast branch-free version from bit-twiddling hacks as older Intel
|
||||
// // processors do not have a POPCNT instruction.
|
||||
// x -= (x >> 1) & 0x55555555;
|
||||
// x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||||
// return (((x + (x >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
|
||||
// #endif
|
||||
}
|
||||
|
||||
static really_inline
|
||||
u32 popcount64(u64a x) {
|
||||
#if defined(ARCH_X86_64)
|
||||
# if defined(HAVE_POPCOUNT_INSTR)
|
||||
// Single-instruction builtin.
|
||||
return (u32)_mm_popcnt_u64(x);
|
||||
# else
|
||||
// Fast branch-free version from bit-twiddling hacks as older Intel
|
||||
// processors do not have a POPCNT instruction.
|
||||
x -= (x >> 1) & 0x5555555555555555;
|
||||
x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);
|
||||
x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f;
|
||||
return (x * 0x0101010101010101) >> 56;
|
||||
# endif
|
||||
#else
|
||||
// Synthesise from two 32-bit cases.
|
||||
return popcount32(x >> 32) + popcount32(x);
|
||||
#endif
|
||||
return __builtin_popcountll(x);
|
||||
// #if defined(ARCH_X86_64)
|
||||
// # if defined(HAVE_POPCOUNT_INSTR)
|
||||
// // Single-instruction builtin.
|
||||
// return (u32)_mm_popcnt_u64(x);
|
||||
// # else
|
||||
// // Fast branch-free version from bit-twiddling hacks as older Intel
|
||||
// // processors do not have a POPCNT instruction.
|
||||
// x -= (x >> 1) & 0x5555555555555555;
|
||||
// x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);
|
||||
// x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f;
|
||||
// return (x * 0x0101010101010101) >> 56;
|
||||
// # endif
|
||||
// #else
|
||||
// // Synthesise from two 32-bit cases.
|
||||
// return popcount32(x >> 32) + popcount32(x);
|
||||
// #endif
|
||||
}
|
||||
|
||||
#endif /* UTIL_POPCOUNT_H_ */
|
||||
|
||||
Reference in New Issue
Block a user