Codebase list radiotap-library / 66c806fc-f46d-4c8a-b1b1-c4dcd6d3376d/main platform.h
66c806fc-f46d-4c8a-b1b1-c4dcd6d3376d/main

Tree @66c806fc-f46d-4c8a-b1b1-c4dcd6d3376d/main (Download .tar.gz)

platform.h @66c806fc-f46d-4c8a-b1b1-c4dcd6d3376d/mainraw · history · blame

#include <stddef.h>
#include <errno.h>
#if defined(__APPLE__)
#include <machine/endian.h>
#else
#include <endian.h>
#endif

#define le16_to_cpu		le16toh
#define le32_to_cpu		le32toh
#define get_unaligned(p)					\
({								\
	struct packed_dummy_struct {				\
		typeof(*(p)) __val;				\
	} __attribute__((packed)) *__ptr = (void *) (p);	\
								\
	__ptr->__val;						\
})
#define get_unaligned_le16(p)	le16_to_cpu(get_unaligned((uint16_t *)(p)))
#define get_unaligned_le32(p)	le32_to_cpu(get_unaligned((uint32_t *)(p)))