From 6f4a10be04df37fc21199101923d80567cfddf3f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 10 Feb 2020 01:38:45 +0100 Subject: [PATCH] Optimize Int48 reconstruction. --- server/TracyEvent.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 708e5662..9672ca61 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -125,10 +125,11 @@ public: tracy_force_inline int64_t Val() const { - int64_t val = 0; - memcpy( ((char*)&val)+2, m_val, 6 ); - val >>= 16; - return val; + int16_t hi; + memcpy( &hi, m_val+4, 2 ); + uint32_t lo; + memcpy( &lo, m_val, 4 ); + return ( int64_t( hi ) << 32 ) | lo; } tracy_force_inline bool IsNonNegative() const