diff options
author | Karel Zak | 2007-12-17 13:18:12 +0100 |
---|---|---|
committer | Karel Zak | 2007-12-17 13:41:13 +0100 |
commit | a34fc3d4ad3c9f80737352df70ddc6b68a6501ae (patch) | |
tree | cb458bc3bca8e980146cb39f7977db8800a17c45 /include/bitops.h | |
parent | include: add bitops.h with swab{16,32,64} macros (diff) | |
download | kernel-qcow2-util-linux-a34fc3d4ad3c9f80737352df70ddc6b68a6501ae.tar.gz kernel-qcow2-util-linux-a34fc3d4ad3c9f80737352df70ddc6b68a6501ae.tar.xz kernel-qcow2-util-linux-a34fc3d4ad3c9f80737352df70ddc6b68a6501ae.zip |
include: add bitops.h with swab{16,32,64} macros
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include/bitops.h')
-rw-r--r-- | include/bitops.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include/bitops.h b/include/bitops.h index 4ae0ff8e4..7b2b17e75 100644 --- a/include/bitops.h +++ b/include/bitops.h @@ -32,20 +32,38 @@ #ifdef WORDS_BIGENDIAN + #define cpu_to_le16(x) swab16(x) #define cpu_to_le32(x) swab32(x) #define cpu_to_le64(x) swab64(x) #define cpu_to_be16(x) (x) #define cpu_to_be32(x) (x) #define cpu_to_be64(x) (x) -#else + +#define le16_to_cpu(x) swab16(x) +#define le32_to_cpu(x) swab32(x) +#define le64_to_cpu(x) swab64(x) +#define be16_to_cpu(x) (x) +#define be32_to_cpu(x) (x) +#define be64_to_cpu(x) (x) + +#else /* !WORDS_BIGENDIAN */ + #define cpu_to_le16(x) (x) #define cpu_to_le32(x) (x) #define cpu_to_le64(x) (x) #define cpu_to_be16(x) swab16(x) #define cpu_to_be32(x) swab32(x) #define cpu_to_be64(x) swab64(x) -#endif + +#define le16_to_cpu(x) (x) +#define le32_to_cpu(x) (x) +#define le64_to_cpu(x) (x) +#define be16_to_cpu(x) swab16(x) +#define be32_to_cpu(x) swab32(x) +#define be64_to_cpu(x) swab64(x) + +#endif /* !WORDS_BIGENDIAN */ #endif /* BITOPS_H */ |