mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Harden client code against unaligned memory access.
There shouldn't be any changes in generated code on modern architectures, as the memcpy will be reduced to a store/load operation identical to the one generated with plain struct member access. GetTime( cpu ) needs special handling, as the MSVC intrinsic for rdtscp can't store cpu identifier in a register. Using intermediate variable would cause store to stack, read from stack, store to the destination address. Since rdtscp is only available on x86, which handles unaligned stores without any problems, we can have one place with direct struct member access.
This commit is contained in:
@@ -31,8 +31,8 @@ enum { WelcomeMessageProgramNameSize = 64 };
|
||||
struct WelcomeMessage
|
||||
{
|
||||
double timerMul;
|
||||
uint64_t initBegin;
|
||||
uint64_t initEnd;
|
||||
int64_t initBegin;
|
||||
int64_t initEnd;
|
||||
uint64_t delay;
|
||||
uint64_t resolution;
|
||||
uint64_t epoch;
|
||||
|
||||
Reference in New Issue
Block a user