0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::util: Add missing popcount specializations. (regression fe0f398e14) (-Wundefined-inline)

This commit is contained in:
Jason Volk 2023-02-09 19:15:05 -08:00
parent 1c6d216daf
commit f930f480c7

View file

@ -20,6 +20,8 @@ inline namespace util
template<> constexpr int popcount(const unsigned long long) noexcept;
template<> constexpr int popcount(const unsigned long) noexcept;
template<> constexpr int popcount(const unsigned int) noexcept;
template<> constexpr int popcount(const unsigned short) noexcept;
template<> constexpr int popcount(const unsigned char) noexcept;
}}
template<>
@ -57,3 +59,27 @@ noexcept
return __builtin_popcount(a);
#endif
}
template<>
constexpr int
ircd::util::popcount(const unsigned short a)
noexcept
{
#if __has_feature(__cpp_lib_bitops)
return std::popcount(a);
#else
return __builtin_popcount(a);
#endif
}
template<>
constexpr int
ircd::util::popcount(const unsigned char a)
noexcept
{
#if __has_feature(__cpp_lib_bitops)
return std::popcount(a);
#else
return __builtin_popcount(a);
#endif
}