Added bitcount/pop implementation perf tests

This commit is contained in:
Christophe Riccio
2014-11-02 21:18:46 +01:00
parent 9ecf69afc4
commit c62b6c7324
4 changed files with 291 additions and 1 deletions

View File

@@ -1190,6 +1190,19 @@ namespace bitCount
return Count;
}
template <typename T>
inline int bitCount_bits(T v)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitCount' only accept integer values");
int Count(0);
for(T i = 0, n = static_cast<T>(sizeof(T) * 8); i < n; ++i)
{
Count += static_cast<int>((v >> i) & static_cast<T>(1));
}
return Count;
}
int perf()
{
int Error(0);