aboutsummaryrefslogtreecommitdiff
path: root/lib/portability.h
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-01-14 20:20:06 -0500
committerRob Landley <rob@landley.net>2007-01-14 20:20:06 -0500
commit055cfcbe5b0534c700b30216f54336b7581f7be4 (patch)
tree8c62c700db81dc09b8d9f7c79c504651dff3acd2 /lib/portability.h
parent3388f4c4de628702ba77e2fec941c809877ad576 (diff)
downloadtoybox-055cfcbe5b0534c700b30216f54336b7581f7be4.tar.gz
Add start of mke2fs/gene2fs, and some other stuff I've been working on.
Diffstat (limited to 'lib/portability.h')
-rw-r--r--lib/portability.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/portability.h b/lib/portability.h
new file mode 100644
index 00000000..dca0ddea
--- /dev/null
+++ b/lib/portability.h
@@ -0,0 +1,21 @@
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define IS_BIG_ENDIAN 1
+#define IS_LITTLE_ENDIAN 0
+#define SWAP_BE16(x) (x)
+#define SWAP_BE32(x) (x)
+#define SWAP_BE64(x) (x)
+#define SWAP_LE16(x) bswap_16(x)
+#define SWAP_LE32(x) bswap_32(x)
+#define SWAP_LE64(x) bswap_64(x)
+#else
+#define IS_LITTLE_ENDIAN 1
+#define IS_BIG_ENDIAN 0
+#define SWAP_BE16(x) bswap_16(x)
+#define SWAP_BE32(x) bswap_32(x)
+#define SWAP_BE64(x) bswap_64(x)
+#define SWAP_LE16(x) (x)
+#define SWAP_LE32(x) (x)
+#define SWAP_LE64(x) (x)
+#endif