1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Use short ptr in VarArray.

This commit is contained in:
Bartosz Taudul 2019-11-03 16:29:05 +01:00
parent 390558b627
commit 5620597fb4
2 changed files with 8 additions and 4 deletions

View File

@ -16,7 +16,7 @@ class short_ptr
{
public:
tracy_force_inline short_ptr() {}
tracy_force_inline short_ptr( T* ptr ) { Set( ptr ); }
tracy_force_inline short_ptr( const T* ptr ) { Set( ptr ); }
tracy_force_inline operator T*() { return Get(); }
tracy_force_inline operator const T*() const { return Get(); }
@ -26,7 +26,7 @@ public:
tracy_force_inline const T* operator->() const { return Get(); }
private:
tracy_force_inline void Set( T* ptr )
tracy_force_inline void Set( const T* ptr )
{
assert( ( uint64_t( ptr ) & 0xFFFF000000000000 ) == 0 );
memcpy( m_ptr, &ptr, 4 );

View File

@ -7,8 +7,9 @@
#include "../common/TracyForceInline.hpp"
#include "tracy_flat_hash_map.hpp"
#include "TracyCharUtil.hpp"
#include "TracyMemory.hpp"
#include "TracyEvent.hpp"
#include "TracyMemory.hpp"
#include "TracyShortPtr.hpp"
namespace tracy
{
@ -51,10 +52,13 @@ private:
uint8_t m_size;
uint32_t m_hash;
const T* m_ptr;
const short_ptr<T> m_ptr;
};
#pragma pack()
enum { VarArraySize = sizeof( VarArray<int> ) };
template<typename T>
inline void VarArray<T>::CalcHash()
{