projects/aports·blob master · refs

27 lines · 834 B

1diff --git a/util/cbfstool/test.c b/util/cbfstool/test.c
2index 2426e3e7..b63522c8 100644
3--- a/util/cbfstool/test.c
4+++ b/util/cbfstool/test.c
5@@ -8,6 +8,22 @@
6 #include <string.h>
7 #include <commonlib/bsd/helpers.h>
8
9+#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
10+#define le64toh(x) (x)
11+#define le32toh(x) (x)
12+#define le16toh(x) (x)
13+#define htole64(x) (x)
14+#define htole32(x) (x)
15+#define htole16(x) (x)
16+#else
17+#define le64toh(x) (__builtin_bswap64(x))
18+#define le32toh(x) (__builtin_bswap32(x))
19+#define le16toh(x) (__builtin_bswap16(x))
20+#define htole64(x) (__builtin_bswap64(x))
21+#define htole32(x) (__builtin_bswap32(x))
22+#define htole16(x) (__builtin_bswap16(x))
23+#endif
24+
25 static enum test_status { pass = EXIT_SUCCESS, fail = EXIT_FAILURE } status;
26
27 static struct fmap *fmap_create_test(void)