bitwise: add popcount overloads for short and char
This commit is contained in:
parent
5106038734
commit
2258279518
18
bitwise.hpp
18
bitwise.hpp
@ -83,6 +83,24 @@ namespace cruft {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/// Calculates the number of bits that are set.
|
||||
constexpr unsigned
|
||||
popcount (unsigned char t)
|
||||
{
|
||||
return __builtin_popcount (t);
|
||||
}
|
||||
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
/// Calculates the number of bits that are set.
|
||||
constexpr unsigned
|
||||
popcount (unsigned short t)
|
||||
{
|
||||
return __builtin_popcount (t);
|
||||
}
|
||||
|
||||
|
||||
///------------------------------------------------------------------------
|
||||
/// Calculates the number of bits that are set.
|
||||
constexpr unsigned
|
||||
popcount (unsigned t)
|
||||
{
|
||||
return __builtin_popcount (t);
|
||||
|
Loading…
Reference in New Issue
Block a user