8 struct PopcountFunction {
9 template<concepts::Un
signedInteger T>
10 constexpr auto operator()(T value)
const ->
int {
11 if constexpr (
sizeof(T) <=
sizeof(
unsigned int)) {
12 return __builtin_popcount(value);
13 }
else if constexpr (
sizeof(T) <=
sizeof(
unsigned long)) {
14 return __builtin_popcountl(value);
15 }
else if constexpr (
sizeof(T) <=
sizeof(
unsigned long long)) {
16 return __builtin_popcountll(value);
18 static_assert(
sizeof(T) == 16);
19 auto low =
u64(value & math::NumericLimits<u64>::max);
20 auto high =
u64(value >> 64);
21 return (*
this)(low) + (*
this)(high);
27constexpr inline auto popcount = detail::PopcountFunction {};
Definition bit_proxy_reference.h:5
constexpr auto popcount
Definition popcount.h:27
__UINT64_TYPE__ u64
Definition integers.h:12
Definition any_storable.h:9