fragattacks/src/utils/platform.h
Ilan Peer dcdce14741 radiotap: Fix compilation for systems without le16toh/le32toh
These functions are not standard and do not exist in all systems, e.g.,
variants of Android. Instead use the macros defined in common.h.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
2014-04-24 12:15:32 +03:00

22 lines
516 B
C

#ifndef PLATFORM_H
#define PLATFORM_H
#include "includes.h"
#include "common.h"
#define le16_to_cpu le_to_host16
#define le32_to_cpu le_to_host32
#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)))
#endif /* PLATFORM_H */