mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Use xxh3 for VarArray hashing.
This commit is contained in:
parent
aed91a4d09
commit
935eb4cc61
@ -5,7 +5,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef XXH_STATIC_LINKING_ONLY
|
||||||
# define XXH_STATIC_LINKING_ONLY
|
# define XXH_STATIC_LINKING_ONLY
|
||||||
|
#endif
|
||||||
#include "tracy_xxh3.h"
|
#include "tracy_xxh3.h"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef XXH_STATIC_LINKING_ONLY
|
||||||
|
# define XXH_STATIC_LINKING_ONLY
|
||||||
|
#endif
|
||||||
|
#include "tracy_xxh3.h"
|
||||||
|
|
||||||
#include "../common/TracyForceInline.hpp"
|
#include "../common/TracyForceInline.hpp"
|
||||||
#include "TracyCharUtil.hpp"
|
#include "TracyCharUtil.hpp"
|
||||||
#include "TracyEvent.hpp"
|
#include "TracyEvent.hpp"
|
||||||
@ -61,23 +66,7 @@ enum { VarArraySize = sizeof( VarArray<int> ) };
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline void VarArray<T>::CalcHash()
|
inline void VarArray<T>::CalcHash()
|
||||||
{
|
{
|
||||||
T hash = 5381;
|
m_hash = uint32_t( XXH3_64bits( m_ptr.get(), m_size * sizeof( T ) ) );
|
||||||
for( uint8_t i=0; i<m_size; i++ )
|
|
||||||
{
|
|
||||||
hash = ( ( hash << 5 ) + hash ) ^ m_ptr[i];
|
|
||||||
}
|
|
||||||
m_hash = uint32_t( hash );
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
inline void VarArray<CallstackFrameId>::CalcHash()
|
|
||||||
{
|
|
||||||
uint64_t hash = 5381;
|
|
||||||
for( uint8_t i=0; i<m_size; i++ )
|
|
||||||
{
|
|
||||||
hash = ( ( hash << 5 ) + hash ) ^ m_ptr[i].data;
|
|
||||||
}
|
|
||||||
m_hash = uint32_t( hash );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user