diff options
author | Bartosz Taudul <wolf.pld@gmail.com> | 2017-11-11 04:31:51 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf.pld@gmail.com> | 2017-11-11 04:31:51 +0300 |
commit | ca4483ecf5385c82b2aa6d67bf826c82e1ab86eb (patch) | |
tree | 51182f80c9796b90ba4f8b92f4e9ad2090f4eb14 /server/TracyCharUtil.hpp | |
parent | 24084cbcd24492d70ed01a4ed5a8a4a951185ad7 (diff) |
Prevent source location payload duplication.
Diffstat (limited to 'server/TracyCharUtil.hpp')
-rw-r--r-- | server/TracyCharUtil.hpp | 15 |
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 |