xref: /freebsd/contrib/wpa/src/utils/platform.h (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1 #ifndef PLATFORM_H
2 #define PLATFORM_H
3 
4 #include "includes.h"
5 #include "common.h"
6 
7 #define le16_to_cpu		le_to_host16
8 #define le32_to_cpu		le_to_host32
9 
10 #define get_unaligned(p)					\
11 ({								\
12 	struct packed_dummy_struct {				\
13 		typeof(*(p)) __val;				\
14 	} __attribute__((packed)) *__ptr = (void *) (p);	\
15 								\
16 	__ptr->__val;						\
17 })
18 #define get_unaligned_le16(p)	le16_to_cpu(get_unaligned((uint16_t *)(p)))
19 #define get_unaligned_le32(p)	le32_to_cpu(get_unaligned((uint32_t *)(p)))
20 
21 #endif /* PLATFORM_H */
22