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-11-11 04:31:51 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2017-11-11 04:31:51 +0300
commitca4483ecf5385c82b2aa6d67bf826c82e1ab86eb (patch)
tree51182f80c9796b90ba4f8b92f4e9ad2090f4eb14 /server/TracyCharUtil.hpp
parent24084cbcd24492d70ed01a4ed5a8a4a951185ad7 (diff)
Prevent source location payload duplication.
Diffstat (limited to 'server/TracyCharUtil.hpp')
-rw-r--r--server/TracyCharUtil.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/TracyCharUtil.hpp b/server/TracyCharUtil.hpp
index ece9de1b..8e1be47d 100644
--- a/server/TracyCharUtil.hpp
+++ b/server/TracyCharUtil.hpp
@@ -23,6 +23,21 @@ static inline uint32_t hash( const char* str )
return hash;
}
+static inline uint32_t hash( const char* str, size_t sz )
+{
+ uint32_t hash = 5381;
+ int c;
+
+ while( sz > 0 )
+ {
+ c = *str++;
+ hash = ( ( hash << 5 ) + hash ) ^ c;
+ sz--;
+ }
+
+ return hash;
+}
+
struct Hasher
{
size_t operator()( const char* key ) const