{
#if defined(__MINGW32__)
return static_cast<int>(__builtin_popcountll(v));
#elif defined(__FreeBSD__) && !defined(__x86_64__)
return static_cast<int>(_mm_popcnt_u32(static_cast<uint32_t>(v)));
#else
return static_cast<int>(_mm_popcnt_u64(v));