mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Add bit counter.
This commit is contained in:
parent
2011524a2d
commit
45cb4b144f
@ -24,6 +24,19 @@
|
||||
# include "../nfd/nfd.h"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
# define CountBits __popcnt64
|
||||
#else
|
||||
static int CountBits( uint64_t i )
|
||||
{
|
||||
i = i - ( (i >> 1) & 0x5555555555555555 );
|
||||
i = ( i & 0x3333333333333333 ) + ( (i >> 2) & 0x3333333333333333 );
|
||||
i = ( (i + (i >> 4) ) & 0x0F0F0F0F0F0F0F0F );
|
||||
return ( i * (0x0101010101010101) ) >> 56;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user