xref: /freebsd/contrib/wpa/src/utils/platform.h (revision dd41de95a84d979615a2ef11df6850622bf6184e)
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((le16 *)(p)))
19 #define get_unaligned_le32(p)	le32_to_cpu(get_unaligned((le32 *)(p)))
20 
21 #endif /* PLATFORM_H */
22