summaryrefslogtreecommitdiff
path: root/ami_slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'ami_slab.c')
-rw-r--r--ami_slab.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ami_slab.c b/ami_slab.c
index 4a47651..6ed6e0e 100644
--- a/ami_slab.c
+++ b/ami_slab.c
@@ -25,6 +25,17 @@
#include <sys/stat.h>
#include <sys/mman.h>
+#if !defined(le32toh) || !defined(le16toh)
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define le32toh(x) (x)
+#define le16toh(x) (x)
+#else
+#include <byteswap.h>
+#define le32toh(x) bswap_32(x)
+#define le16toh(x) bswap_16(x)
+#endif
+#endif
+
struct slabentry {
uint32_t destaddr;
uint32_t length_flag;