Haha, fixed some sillyness with the client in c.
[soho-sigint.git] / client-wifi / client-c / platform.h
1 #include <stddef.h>
2 #include <errno.h>
3 #ifndef _BSD_SOURCE
4 #define _BSD_SOURCE
5 #endif
6 #ifdef __FreeBSD__
7         #include <sys/endian.h>
8 #else
9         #include <endian.h>
10 #endif
11
12 #define le16_to_cpu             le16toh
13 #define le32_to_cpu             le32toh
14 #define get_unaligned(p)                                        \
15 ({                                                              \
16         struct packed_dummy_struct {                            \
17                 typeof(*(p)) __val;                             \
18         } __attribute__((packed)) *__ptr = (void *) (p);        \
19                                                                 \
20         __ptr->__val;                                           \
21 })
22 #define get_unaligned_le16(p)   le16_to_cpu(get_unaligned((uint16_t *)(p)))
23 #define get_unaligned_le32(p)   le32_to_cpu(get_unaligned((uint32_t *)(p)))