1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Standard way of string reference storage in SourceLocation.

StringRef::isptr was changed to isidx, as initialization of empty
SourceLocation zeroes the struct.
This commit is contained in:
Bartosz Taudul
2017-11-11 02:02:47 +01:00
parent 947cd04e5e
commit 24084cbcd2
3 changed files with 48 additions and 90 deletions
+20 -5
View File
@@ -12,12 +12,28 @@ namespace tracy
struct StringRef
{
enum Type { Ptr, Idx };
StringRef() {}
StringRef( Type t, uint64_t data )
: isidx( t == Idx )
{
if( isidx )
{
stridx = (uint32_t)data;
}
else
{
strptr = data;
}
}
union
{
uint64_t strptr;
uint32_t stridx;
};
bool isptr;
bool isidx;
};
struct TextData
@@ -28,11 +44,10 @@ struct TextData
struct SourceLocation
{
uint64_t function; // ptr
uint64_t file; // ptr
StringRef function;
StringRef file;
uint32_t line;
uint32_t color : 31;
uint32_t stringsAllocated : 1;
uint32_t color;
};
enum { SourceLocationSize = sizeof( SourceLocation ) };