mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 12:53:51 +00:00
Replace djb hash with xxh3.
This commit is contained in:
parent
17ee1aed5f
commit
5df7444cbb
@ -186,6 +186,7 @@
|
|||||||
<ClInclude Include="..\..\..\server\TracyWorker.hpp" />
|
<ClInclude Include="..\..\..\server\TracyWorker.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\tracy_flat_hash_map.hpp" />
|
<ClInclude Include="..\..\..\server\tracy_flat_hash_map.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\tracy_pdqsort.h" />
|
<ClInclude Include="..\..\..\server\tracy_pdqsort.h" />
|
||||||
|
<ClInclude Include="..\..\..\server\tracy_xxh3.h" />
|
||||||
<ClInclude Include="..\..\libs\gl3w\GL\gl3w.h" />
|
<ClInclude Include="..\..\libs\gl3w\GL\gl3w.h" />
|
||||||
<ClInclude Include="..\..\libs\gl3w\GL\glcorearb.h" />
|
<ClInclude Include="..\..\libs\gl3w\GL\glcorearb.h" />
|
||||||
<ClInclude Include="..\..\src\Arimo.hpp" />
|
<ClInclude Include="..\..\src\Arimo.hpp" />
|
||||||
|
@ -299,6 +299,9 @@
|
|||||||
<ClInclude Include="..\..\..\server\TracyShortPtr.hpp">
|
<ClInclude Include="..\..\..\server\TracyShortPtr.hpp">
|
||||||
<Filter>server</Filter>
|
<Filter>server</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\server\tracy_xxh3.h">
|
||||||
|
<Filter>server</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Natvis Include="DebugVis.natvis" />
|
<Natvis Include="DebugVis.natvis" />
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define XXH_STATIC_LINKING_ONLY
|
||||||
|
#include "tracy_xxh3.h"
|
||||||
#include "tracy_flat_hash_map.hpp"
|
#include "tracy_flat_hash_map.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
@ -12,32 +14,15 @@ namespace tracy
|
|||||||
namespace charutil
|
namespace charutil
|
||||||
{
|
{
|
||||||
|
|
||||||
static inline uint32_t hash( const char* str )
|
static inline size_t hash( const char* str )
|
||||||
{
|
{
|
||||||
uint32_t hash = 5381;
|
const auto sz = strlen( str );
|
||||||
int c;
|
return XXH3_64bits( str, sz );
|
||||||
|
|
||||||
while( ( c = *str++ ) != 0 )
|
|
||||||
{
|
|
||||||
hash = ( ( hash << 5 ) + hash ) ^ c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t hash( const char* str, size_t sz )
|
static inline size_t hash( const char* str, size_t sz )
|
||||||
{
|
{
|
||||||
uint32_t hash = 5381;
|
return XXH3_64bits( str, sz );
|
||||||
int c;
|
|
||||||
|
|
||||||
while( sz > 0 )
|
|
||||||
{
|
|
||||||
c = *str++;
|
|
||||||
hash = ( ( hash << 5 ) + hash ) ^ c;
|
|
||||||
sz--;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Hasher
|
struct Hasher
|
||||||
|
Loading…
x
Reference in New Issue
Block a user