… | |
… | |
600 | ecb_function_ ecb_const int |
600 | ecb_function_ ecb_const int |
601 | ecb_popcount64 (uint64_t x) |
601 | ecb_popcount64 (uint64_t x) |
602 | { |
602 | { |
603 | /* popcount64 is only available on 64 bit cpus as gcc builtin. */ |
603 | /* popcount64 is only available on 64 bit cpus as gcc builtin. */ |
604 | /* also, gcc/clang make this surprisingly difficult to use */ |
604 | /* also, gcc/clang make this surprisingly difficult to use */ |
605 | #if __LP64__ && (ECB_GCC_VERSION(3,4) || ECB_CLANG_BUILTIN (__builtin_popcountl)) |
605 | #if (__SIZEOF_LONG__ == 8) && (ECB_GCC_VERSION(3,4) || ECB_CLANG_BUILTIN (__builtin_popcountl)) |
606 | return __builtin_popcountl (x); |
606 | return __builtin_popcountl (x); |
607 | #else |
607 | #else |
608 | return ecb_popcount32 (x) + ecb_popcount32 (x >> 32); |
608 | return ecb_popcount32 (x) + ecb_popcount32 (x >> 32); |
609 | #endif |
609 | #endif |
610 | } |
610 | } |