Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2019-11-09 02:25:12 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2019-11-09 02:25:12 +0300
commit2131eed4e72e1e429414575ab7fb185a1f39bd2d (patch)
tree945adff9401c8b28bb3cee0b517fd8572138e1a1 /server/TracyFileRead.hpp
parente80a19234e5509873bbad9a9817b4981ba37b191 (diff)
Support multiple types in Read2().
Diffstat (limited to 'server/TracyFileRead.hpp')
-rw-r--r--server/TracyFileRead.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/server/TracyFileRead.hpp b/server/TracyFileRead.hpp
index 1e55a348..80918cc1 100644
--- a/server/TracyFileRead.hpp
+++ b/server/TracyFileRead.hpp
@@ -77,21 +77,21 @@ public:
}
- template<class T>
- tracy_force_inline void Read2( T& v0, T& v1 )
+ template<class T, class U>
+ tracy_force_inline void Read2( T& v0, U& v1 )
{
- if( sizeof( T ) * 2 < BufSize - m_offset )
+ if( sizeof( T ) + sizeof( U ) < BufSize - m_offset )
{
memcpy( &v0, m_buf + m_offset, sizeof( T ) );
- memcpy( &v1, m_buf + m_offset + sizeof( T ), sizeof( T ) );
- m_offset += sizeof( T ) * 2;
+ memcpy( &v1, m_buf + m_offset + sizeof( T ), sizeof( U ) );
+ m_offset += sizeof( T ) + sizeof( U );
}
else
{
- T tmp[2];
- ReadBig( tmp, sizeof( T ) * 2 );
+ char tmp[sizeof( T ) + sizeof( U )];
+ ReadBig( tmp, sizeof( T ) + sizeof( U ) );
memcpy( &v0, tmp, sizeof( T ) );
- memcpy( &v1, tmp+1, sizeof( T ) );
+ memcpy( &v1, tmp + sizeof( T ), sizeof( U ) );
}
}