diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-29 11:23:29 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-29 11:23:29 +0300 |
| commit | e148f38dc937c34b222ba8df8612b3fa2b6bc349 (patch) | |
| tree | c51f045c6632b2073cb0e3183bd9d3b559ccd228 /include/apos/unaligned.h | |
| parent | 360c18fcbe228220e5c9799fb30b2032982c06cf (diff) | |
| download | kmi-e148f38dc937c34b222ba8df8612b3fa2b6bc349.tar.gz kmi-e148f38dc937c34b222ba8df8612b3fa2b6bc349.zip | |
modify formatting rules
Diffstat (limited to 'include/apos/unaligned.h')
| -rw-r--r-- | include/apos/unaligned.h | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/include/apos/unaligned.h b/include/apos/unaligned.h index 94439ca..85d67b0 100644 --- a/include/apos/unaligned.h +++ b/include/apos/unaligned.h @@ -9,35 +9,35 @@ #include <apos/types.h> #include <apos/attrs.h> -#define get_unaligned(ptr) \ - _Generic(*(ptr), uint8_t \ - : __get_unaligned_uint8_t, uint16_t \ - : __get_unaligned_uint16_t, uint32_t \ - : __get_unaligned_uint32_t, uint64_t \ - : __get_unaligned_uint64_t, int8_t \ - : __get_unaligned_int8_t, int16_t \ - : __get_unaligned_int16_t, int32_t \ - : __get_unaligned_int32_t, int64_t \ +#define get_unaligned(ptr) \ + _Generic(*(ptr), uint8_t \ + : __get_unaligned_uint8_t, uint16_t \ + : __get_unaligned_uint16_t, uint32_t \ + : __get_unaligned_uint32_t, uint64_t \ + : __get_unaligned_uint64_t, int8_t \ + : __get_unaligned_int8_t, int16_t \ + : __get_unaligned_int16_t, int32_t \ + : __get_unaligned_int32_t, int64_t \ : __get_unaligned_int64_t)((void *)ptr) -#define put_unaligned(val, ptr) \ - _Generic(*(ptr), uint8_t \ - : __put_unaligned_uint8_t, uint16_t \ - : __put_unaligned_uint16_t, uint32_t \ - : __put_unaligned_uint32_t, uint64_t \ - : __put_unaligned_uint64_t, int8_t \ - : __put_unaligned_int8_t, int16_t \ - : __put_unaligned_int16_t, int32_t \ - : __put_unaligned_int32_t, int64_t \ +#define put_unaligned(val, ptr) \ + _Generic(*(ptr), uint8_t \ + : __put_unaligned_uint8_t, uint16_t \ + : __put_unaligned_uint16_t, uint32_t \ + : __put_unaligned_uint32_t, uint64_t \ + : __put_unaligned_uint64_t, int8_t \ + : __put_unaligned_int8_t, int16_t \ + : __put_unaligned_int16_t, int32_t \ + : __put_unaligned_int32_t, int64_t \ : __put_unaligned_int64_t)(val, (void *)ptr) -#define DEFINE_GET(type) \ - static inline type __get_unaligned_##type(void *ptr) \ - { \ - const struct __packed { \ - type x; \ - } *__pptr = ptr; \ - return __pptr->x; \ +#define DEFINE_GET(type) \ + static inline type __get_unaligned_##type(void *ptr) \ + { \ + const struct __packed { \ + type x; \ + } *__pptr = ptr; \ + return __pptr->x; \ } DEFINE_GET(uint8_t); @@ -51,13 +51,13 @@ DEFINE_GET(int64_t); #undef DEFINE_GET -#define DEFINE_PUT(type) \ - static inline void __put_unaligned_##type(type val, void *ptr) \ - { \ - struct __packed { \ - type x; \ - } *__pptr = ptr; \ - __pptr->x = val; \ +#define DEFINE_PUT(type) \ + static inline void __put_unaligned_##type(type val, void *ptr) \ + { \ + struct __packed { \ + type x; \ + } *__pptr = ptr; \ + __pptr->x = val; \ } DEFINE_PUT(uint8_t); |
