mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
No nonsense union.
This commit is contained in:
parent
5afdccfc46
commit
5cb917e868
@ -17,27 +17,16 @@ struct StringRef
|
||||
{
|
||||
enum Type { Ptr, Idx };
|
||||
|
||||
StringRef() : strptr( 0 ), __data( 0 ) {}
|
||||
StringRef( Type t, uint64_t data ) : __data( 0 )
|
||||
StringRef() : str( 0 ), __data( 0 ) {}
|
||||
StringRef( Type t, uint64_t data )
|
||||
: str( data )
|
||||
, __data( 0 )
|
||||
{
|
||||
isidx = t == Idx;
|
||||
active = 1;
|
||||
|
||||
if( isidx )
|
||||
{
|
||||
stridx = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
strptr = data;
|
||||
}
|
||||
}
|
||||
|
||||
union
|
||||
{
|
||||
uint64_t strptr;
|
||||
uint64_t stridx;
|
||||
};
|
||||
uint64_t str;
|
||||
|
||||
union
|
||||
{
|
||||
@ -53,7 +42,8 @@ struct StringRef
|
||||
struct StringIdx
|
||||
{
|
||||
StringIdx() : __data( 0 ) {}
|
||||
StringIdx( uint32_t _idx ) : __data( 0 )
|
||||
StringIdx( uint32_t _idx )
|
||||
: __data( 0 )
|
||||
{
|
||||
idx = _idx;
|
||||
active = 1;
|
||||
|
@ -325,13 +325,13 @@ const char* Worker::GetString( const StringRef& ref ) const
|
||||
if( ref.isidx )
|
||||
{
|
||||
assert( ref.active );
|
||||
return m_data.stringData[ref.stridx];
|
||||
return m_data.stringData[ref.str];
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ref.active )
|
||||
{
|
||||
return GetString( ref.strptr );
|
||||
return GetString( ref.str );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user