From 1655bf284f36fba4cb06a6f43ad434163630b7de Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 12 Feb 2020 01:58:36 +0100 Subject: [PATCH] More Int24/Int48 optimizations. --- server/TracyEvent.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 048a83c3..ed861da1 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -95,14 +95,18 @@ public: tracy_force_inline void SetVal( uint32_t val ) { - memcpy( m_val, &val, 3 ); + memcpy( m_val, &val, 2 ); + val >>= 16; + memcpy( m_val+2, &val, 1 ); } tracy_force_inline uint32_t Val() const { - uint32_t val = 0; - memcpy( &val, m_val, 3 ); - return val; + uint8_t hi; + memcpy( &hi, m_val+2, 1 ); + uint16_t lo; + memcpy( &lo, m_val, 2 ); + return ( uint32_t( hi ) << 16 ) | lo; } private: @@ -120,7 +124,9 @@ public: tracy_force_inline void SetVal( int64_t val ) { - memcpy( m_val, &val, 6 ); + memcpy( m_val, &val, 4 ); + val >>= 32; + memcpy( m_val+4, &val, 2 ); } tracy_force_inline int64_t Val() const