Replace utils::popcnt32 with std::popcount

Cleanup includes.
This commit is contained in:
Nekotekina 2020-04-13 21:58:17 +03:00
parent 032e7c0491
commit f72af2973d
5 changed files with 2 additions and 22 deletions

View file

@ -4,23 +4,6 @@
namespace utils
{
inline u8 popcnt32(u32 arg)
{
#ifdef _MSC_VER
const u32 a1 = arg & 0x55555555;
const u32 a2 = (arg >> 1) & 0x55555555;
const u32 a3 = a1 + a2;
const u32 b1 = a3 & 0x33333333;
const u32 b2 = (a3 >> 2) & 0x33333333;
const u32 b3 = b1 + b2;
const u32 c3 = (b3 + (b3 >> 4)) & 0x0f0f0f0f;
const u32 d3 = c3 + (c3 >> 8);
return static_cast<u8>(d3 + (d3 >> 16));
#else
return __builtin_popcount(arg);
#endif
}
// Rotate helpers
#if defined(__GNUG__)