From 925909aa3a9ae7d9b6941a9c1d075ceb0057c813 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 12 Feb 2020 02:13:50 +0100 Subject: [PATCH] Wrapper for reading 6 elements at once. --- server/TracyFileRead.hpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/server/TracyFileRead.hpp b/server/TracyFileRead.hpp index 406eb4a3..c987c657 100644 --- a/server/TracyFileRead.hpp +++ b/server/TracyFileRead.hpp @@ -166,6 +166,32 @@ public: } } + template + tracy_force_inline void Read6( T& v0, U& v1, V& v2, W& v3, X& v4, Y& v5 ) + { + if( sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ) + sizeof( X ) + sizeof( Y ) < BufSize - m_offset ) + { + memcpy( &v0, m_buf + m_offset, sizeof( T ) ); + memcpy( &v1, m_buf + m_offset + sizeof( T ), sizeof( U ) ); + memcpy( &v2, m_buf + m_offset + sizeof( T ) + sizeof( U ), sizeof( V ) ); + memcpy( &v3, m_buf + m_offset + sizeof( T ) + sizeof( U ) + sizeof( V ), sizeof( W ) ); + memcpy( &v4, m_buf + m_offset + sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ), sizeof( X ) ); + memcpy( &v5, m_buf + m_offset + sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ) + sizeof( X ), sizeof( Y ) ); + m_offset += sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ) + sizeof( X ) + sizeof( Y ); + } + else + { + char tmp[sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ) + sizeof( X ) + sizeof( Y )]; + ReadBig( tmp, sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ) + sizeof( X ) + sizeof( Y ) ); + memcpy( &v0, tmp, sizeof( T ) ); + memcpy( &v1, tmp + sizeof( T ), sizeof( U ) ); + memcpy( &v2, tmp + sizeof( T ) + sizeof( U ), sizeof( V ) ); + memcpy( &v3, tmp + sizeof( T ) + sizeof( U ) + sizeof( V ), sizeof( W ) ); + memcpy( &v4, tmp + sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ), sizeof( X ) ); + memcpy( &v5, tmp + sizeof( T ) + sizeof( U ) + sizeof( V ) + sizeof( W ) + sizeof( X ), sizeof( Y ) ); + } + } + bool IsEOF() { if( m_lastBlock != BufSize && m_offset == m_lastBlock ) return true;