xref: /freebsd/contrib/wpa/src/utils/platform.h (revision 63d1fd5970ec814904aa0f4580b10a0d302d08b2)
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