blob: a84008d5b40c8198b5a82a317a90edb4110deff5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#ifndef __TRACYPOPCNT_HPP__
#define __TRACYPOPCNT_HPP__
#include <limits.h>
#if defined _WIN64
# include <intrin.h>
# define TracyCountBits __popcnt64
#elif defined __GNUC__ || defined __clang__
# define TracyCountBits __builtin_popcountll
#else
static inline int TracyCountBits( uint64_t i )
{
i = i - ( (i >> 1) & 0x5555555555555555 );
i = ( i & 0x3333333333333333 ) + ( (i >> 2) & 0x3333333333333333 );
i = ( (i + (i >> 4) ) & 0x0F0F0F0F0F0F0F0F );
return ( i * (0x0101010101010101) ) >> 56;
}
#endif
#endif
|