Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2017-10-29 00:12:11 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2017-10-29 00:12:11 +0300
commit34123de977738aa4097d72e6d7e35b299443286d (patch)
treeb507f165829b881643c665cecfe810f554439947 /server/TracyPopcnt.hpp
parent1a117b330f03b6a0b9f489d26510e95dcfe407ec (diff)
Reduce custom vector size 16 -> 13 bytes.
Diffstat (limited to 'server/TracyPopcnt.hpp')
-rw-r--r--server/TracyPopcnt.hpp17
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