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>2018-05-01 02:47:29 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2018-05-01 03:13:49 +0300
commit5deeb8426f2f9cb78c34e72e30e06fcb564743cc (patch)
tree81196a518d26f77d55abac74834b8e010d99cc35 /server/TracyFileRead.hpp
parent8beb1c1a3966b0be1cb8c39f21668e1d9704247f (diff)
Specialized Read function writing directly to registers.
Diffstat (limited to 'server/TracyFileRead.hpp')
-rw-r--r--server/TracyFileRead.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/server/TracyFileRead.hpp b/server/TracyFileRead.hpp
index 0ebcb5d6..d566bc41 100644
--- a/server/TracyFileRead.hpp
+++ b/server/TracyFileRead.hpp
@@ -54,6 +54,41 @@ public:
}
}
+ template<class T>
+ tracy_force_inline void Read( T& v )
+ {
+ if( sizeof( T ) < BufSize - m_offset )
+ {
+ memcpy( &v, m_buf + m_offset, sizeof( T ) );
+ m_offset += sizeof( T );
+ }
+ else
+ {
+ T tmp;
+ ReadBig( &tmp, sizeof( T ) );
+ memcpy( &v, &tmp, sizeof( T ) );
+ }
+
+ }
+
+ template<class T>
+ tracy_force_inline void Read2( T& v0, T& v1 )
+ {
+ if( sizeof( T ) * 2 < 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;
+ }
+ else
+ {
+ T tmp[2];
+ ReadBig( tmp, sizeof( T ) * 2 );
+ memcpy( &v0, tmp, sizeof( T ) );
+ memcpy( &v1, tmp+1, sizeof( T ) );
+ }
+ }
+
bool IsEOF()
{
if( m_lastBlock != BufSize && m_offset == m_lastBlock ) return true;