diff --git a/server/TracyShortPtr.hpp b/server/TracyShortPtr.hpp index a1c542c8..dc410e7f 100644 --- a/server/TracyShortPtr.hpp +++ b/server/TracyShortPtr.hpp @@ -16,27 +16,23 @@ class short_ptr { public: tracy_force_inline short_ptr() {} - tracy_force_inline short_ptr( const 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(); } - tracy_force_inline T& operator*() { return *Get(); } - tracy_force_inline const T& operator*() const { return *Get(); } - tracy_force_inline T* operator->() { return Get(); } - tracy_force_inline const T* operator->() const { return Get(); } + tracy_force_inline operator T*() { return get(); } + tracy_force_inline operator const T*() const { return get(); } + tracy_force_inline T& operator*() { return *get(); } + tracy_force_inline const T& operator*() const { return *get(); } + tracy_force_inline T* operator->() { return get(); } + tracy_force_inline const T* operator->() const { return get(); } - tracy_force_inline T* get() { return Get(); } - tracy_force_inline const T* get() const { return Get(); } - -private: - tracy_force_inline void Set( const T* ptr ) + tracy_force_inline void set( const T* ptr ) { assert( ( uint64_t( ptr ) & 0xFFFF000000000000 ) == 0 ); memcpy( m_ptr, &ptr, 4 ); memcpy( m_ptr+4, ((char*)&ptr)+4, 2 ); } - tracy_force_inline T* Get() + tracy_force_inline T* get() { uint32_t lo; uint16_t hi; @@ -45,7 +41,7 @@ private: return (T*)( uint64_t( lo ) | ( ( uint64_t( hi ) << 32 ) ) ); } - tracy_force_inline const T* Get() const + tracy_force_inline const T* get() const { uint32_t lo; uint16_t hi; @@ -54,6 +50,7 @@ private: return (T*)( uint64_t( lo ) | ( ( uint64_t( hi ) << 32 ) ) ); } +private: uint8_t m_ptr[6]; }; #else @@ -71,6 +68,7 @@ public: tracy_force_inline T* operator->() { return m_ptr; } tracy_force_inline const T* operator->() const { return m_ptr; } + tracy_force_inline void set( const T* ptr ) { m_ptr = ptr; } tracy_force_inline T* get() { return m_ptr; } tracy_force_inline const T* get() const { return m_ptr; }