Store pointers as uint64.

Pointers can't be stored as pointers, as that would cause mismatch in
wire protocol between 32 and 64 bit builds.
This commit is contained in:
Bartosz Taudul 2017-09-13 01:24:42 +02:00
parent e8d64de5c1
commit 997f0c64c3
2 changed files with 4 additions and 3 deletions

View File

@ -18,8 +18,8 @@ enum class QueueType : uint8_t
struct QueueZoneBegin struct QueueZoneBegin
{ {
uint64_t id; uint64_t id;
const char* filename; uint64_t filename; // ptr
const char* function; uint64_t function; // ptr
uint32_t line; uint32_t line;
}; };
@ -54,6 +54,7 @@ static const size_t QueueDataSize[] = {
}; };
static_assert( sizeof( QueueDataSize ) / sizeof( size_t ) == (uint8_t)QueueType::NUM_TYPES, "QueueDataSize mismatch" ); static_assert( sizeof( QueueDataSize ) / sizeof( size_t ) == (uint8_t)QueueType::NUM_TYPES, "QueueDataSize mismatch" );
static_assert( sizeof( void* ) <= sizeof( uint64_t ), "Pointer size > 8 bytes" );
}; };

View File

@ -14,7 +14,7 @@ public:
ScopedZone( const char* file, const char* function, uint32_t line ) ScopedZone( const char* file, const char* function, uint32_t line )
: m_id( Profiler::GetNewId() ) : m_id( Profiler::GetNewId() )
{ {
Profiler::ZoneBegin( QueueZoneBegin { m_id, file, function, line } ); Profiler::ZoneBegin( QueueZoneBegin { m_id, (uint64_t)file, (uint64_t)function, line } );
} }
~ScopedZone() ~ScopedZone()