mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-30 01:23:20 -08:00
tidy up guid on linux
This commit is contained in:
1 parent
d177e39a54
commit
d114a0e961
2 files changed
+13
-12
No files matched your search
+10
-6
@@ -489,13 +489,17 @@ struct TxtRng
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ Globally Unique Ids
|
//~ Globally Unique Ids
|
||||||
|
|
||||||
typedef struct Guid Guid;
|
typedef union Guid Guid;
|
||||||
struct Guid
|
union Guid
|
||||||
{
|
{
|
||||||
U32 data1;
|
struct
|
||||||
U16 data2;
|
{
|
||||||
U16 data3;
|
U32 data1;
|
||||||
U8 data4[8];
|
U16 data2;
|
||||||
|
U16 data3;
|
||||||
|
U8 data4[8];
|
||||||
|
};
|
||||||
|
U8 v[16];
|
||||||
};
|
};
|
||||||
StaticAssert(sizeof(Guid) == 16, g_guid_size_check);
|
StaticAssert(sizeof(Guid) == 16, g_guid_size_check);
|
||||||
|
|
||||||
|
|||||||
@@ -1133,14 +1133,11 @@ os_safe_call(OS_ThreadFunctionType *func, OS_ThreadFunctionType *fail_handler, v
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: @os_hooks GUIDs (Implemented Per-OS)
|
//~ rjf: @os_hooks GUIDs (Implemented Per-OS)
|
||||||
|
|
||||||
internal OS_Guid
|
internal Guid
|
||||||
os_make_guid(void)
|
os_make_guid(void)
|
||||||
{
|
{
|
||||||
U8 random_bytes[16] = {0};
|
Guid guid = {0};
|
||||||
StaticAssert(sizeof(random_bytes) == sizeof(OS_Guid), os_lnx_guid_size_check);
|
getrandom(guid.v, sizeof(guid.v), 0);
|
||||||
getrandom(random_bytes, sizeof(random_bytes), 0);
|
|
||||||
OS_Guid guid = {0};
|
|
||||||
MemoryCopy(&guid, random_bytes, sizeof(random_bytes));
|
|
||||||
guid.data3 &= 0x0fff;
|
guid.data3 &= 0x0fff;
|
||||||
guid.data3 |= (4 << 12);
|
guid.data3 |= (4 << 12);
|
||||||
guid.data4[0] &= 0x3f;
|
guid.data4[0] &= 0x3f;
|
||||||
|
|||||||
Reference in new issue
Block a user