diff options
author | Peter H. Froehlich <peter.hans.froehlich@gmail.com> | 2021-09-04 18:16:47 +0200 |
---|---|---|
committer | Peter H. Froehlich <peter.hans.froehlich@gmail.com> | 2021-09-04 18:16:47 +0200 |
commit | 4a275b2e66edd7305992fc8ec5d69e7cd43d7f2f (patch) | |
tree | df9c21b4d4f8152e0025ed00f1685cc0f693713d /guid.c | |
parent | abf78a769768254b2333ceff04b3c64da34a5d19 (diff) | |
download | mkgpt-4a275b2e66edd7305992fc8ec5d69e7cd43d7f2f.tar.gz |
Remove part.h, more unaligned accesses, more named constants, proper exit status.
Diffstat (limited to 'guid.c')
-rw-r--r-- | guid.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/guid.c b/guid.c index ed9e6d2..a8a9b65 100644 --- a/guid.c +++ b/guid.c @@ -22,6 +22,7 @@ */ #include "guid.h" +#include "unaligned.h" #include <stdio.h> #include <stdlib.h> @@ -75,10 +76,9 @@ guid_to_bytestring(uint8_t *bytes, const GUID *guid) return -1; } - /* TODO potential alignment problem? */ - *(uint32_t *)&bytes[0] = guid->data1; - *(uint16_t *)&bytes[4] = guid->data2; - *(uint16_t *)&bytes[6] = guid->data3; + set_u32(bytes + 0, guid->data1); + set_u16(bytes + 4, guid->data2); + set_u16(bytes + 6, guid->data3); for (int i = 0; i < 8; i++) { bytes[8 + i] = guid->data4[i]; } |