From 055cfcbe5b0534c700b30216f54336b7581f7be4 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 14 Jan 2007 20:20:06 -0500 Subject: Add start of mke2fs/gene2fs, and some other stuff I've been working on. --- lib/portability.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/portability.h (limited to 'lib/portability.h') 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 + +#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 -- cgit v1.2.3