diff options
author | Bartosz Taudul <wolf.pld@gmail.com> | 2017-10-29 00:12:11 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf.pld@gmail.com> | 2017-10-29 00:12:11 +0300 |
commit | 34123de977738aa4097d72e6d7e35b299443286d (patch) | |
tree | b507f165829b881643c665cecfe810f554439947 /server/TracyPopcnt.hpp | |
parent | 1a117b330f03b6a0b9f489d26510e95dcfe407ec (diff) |
Reduce custom vector size 16 -> 13 bytes.
Diffstat (limited to 'server/TracyPopcnt.hpp')
-rw-r--r-- | server/TracyPopcnt.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/TracyPopcnt.hpp b/server/TracyPopcnt.hpp new file mode 100644 index 00000000..d6e4af03 --- /dev/null +++ b/server/TracyPopcnt.hpp @@ -0,0 +1,17 @@ +#ifndef __TRACYPOPCNT_HPP__ +#define __TRACYPOPCNT_HPP__ + +#ifdef _MSC_VER +# include <intrin.h> +# define TracyCountBits __popcnt64 +#else +static 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 |