diff options
Diffstat (limited to 'lib/unaligned.h')
-rw-r--r-- | lib/unaligned.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/unaligned.h b/lib/unaligned.h index 0da1fdb4..dfe0906f 100644 --- a/lib/unaligned.h +++ b/lib/unaligned.h @@ -20,6 +20,12 @@ #include "sysdep/unix/endian.h" #include "lib/string.h" +static inline u8 +get_u8(const void *p) +{ + return * (u8 *) p; +} + static inline u16 get_u16(const void *p) { @@ -53,6 +59,12 @@ get_u64(const void *p) } static inline void +put_u8(void *p, u8 x) +{ + memcpy(p, &x, 1); +} + +static inline void put_u16(void *p, u16 x) { x = htons(x); |