Go to the documentation of this file.00001 #include <stddef.h>
00002 #include <errno.h>
00003 #ifndef _BSD_SOURCE
00004 #define _BSD_SOURCE
00005 #endif
00006 #include <endian.h>
00007
00008 #define le16_to_cpu le16toh
00009 #define le32_to_cpu le32toh
00010 #define get_unaligned(p) \
00011 ({ \
00012 struct packed_dummy_struct { \
00013 typeof(*(p)) __val; \
00014 } __attribute__((packed)) *__ptr = (void *) (p); \
00015 \
00016 __ptr->__val; \
00017 })
00018 #define get_unaligned_le16(p) le16_to_cpu(get_unaligned((uint16_t *)(p)))
00019 #define get_unaligned_le32(p) le32_to_cpu(get_unaligned((uint32_t *)(p)))