mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Force inline file read and write functions.
This commit is contained in:
parent
59c7cf2bcd
commit
43ed934204
@ -6,6 +6,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/tracy_lz4.hpp"
|
#include "../common/tracy_lz4.hpp"
|
||||||
|
#include "../common/TracyForceInline.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
@ -25,7 +26,7 @@ public:
|
|||||||
LZ4_freeStreamDecode( m_stream );
|
LZ4_freeStreamDecode( m_stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Read( void* ptr, size_t size )
|
tracy_force_inline void Read( void* ptr, size_t size )
|
||||||
{
|
{
|
||||||
if( size <= BufSize - m_offset )
|
if( size <= BufSize - m_offset )
|
||||||
{
|
{
|
||||||
@ -43,9 +44,8 @@ public:
|
|||||||
m_offset = 0;
|
m_offset = 0;
|
||||||
uint32_t sz;
|
uint32_t sz;
|
||||||
fread( &sz, 1, sizeof( sz ), m_file );
|
fread( &sz, 1, sizeof( sz ), m_file );
|
||||||
char lz4[LZ4Size];
|
fread( m_lz4buf, 1, sz, m_file );
|
||||||
fread( lz4, 1, sz, m_file );
|
LZ4_decompress_safe_continue( m_stream, m_lz4buf, m_buf[m_active], sz, BufSize );
|
||||||
LZ4_decompress_safe_continue( m_stream, lz4, m_buf[m_active], sz, BufSize );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto sz = std::min( size, BufSize - m_offset );
|
const auto sz = std::min( size, BufSize - m_offset );
|
||||||
@ -71,6 +71,7 @@ private:
|
|||||||
LZ4_streamDecode_t* m_stream;
|
LZ4_streamDecode_t* m_stream;
|
||||||
FILE* m_file;
|
FILE* m_file;
|
||||||
char m_buf[2][BufSize];
|
char m_buf[2][BufSize];
|
||||||
|
char m_lz4buf[LZ4Size];
|
||||||
size_t m_offset;
|
size_t m_offset;
|
||||||
uint8_t m_active;
|
uint8_t m_active;
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/tracy_lz4.hpp"
|
#include "../common/tracy_lz4.hpp"
|
||||||
|
#include "../common/TracyForceInline.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
@ -29,7 +30,7 @@ public:
|
|||||||
LZ4_freeStream( m_stream );
|
LZ4_freeStream( m_stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write( const void* ptr, size_t size )
|
tracy_force_inline void Write( const void* ptr, size_t size )
|
||||||
{
|
{
|
||||||
if( m_offset + size <= BufSize )
|
if( m_offset + size <= BufSize )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user