summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2002-06-28 08:10:29 -0400
committerTheodore Ts'o <tytso@mit.edu>2002-06-28 08:10:29 -0400
commit2cb403b255f1254a29f26d2b356e7764c0f12506 (patch)
treedac492a346a09eed3afb52fa7eda46338c2b0460 /lib
parent5818d6789aaa795aeee1fdb0f7d812a1cabe3d1d (diff)
downloade2fsprogs-2cb403b255f1254a29f26d2b356e7764c0f12506.tar.gz
bitops.h: Add #define's for ext2fs_{l,b}e{32,16}_to_cpu and
ext2fs_cpu_to_{l,b}e{32,16}
Diffstat (limited to 'lib')
-rw-r--r--lib/ext2fs/ChangeLog5
-rw-r--r--lib/ext2fs/bitops.h20
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 8e14c929..1eff9101 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-28 Theodore Ts'o <tytso@mit.edu>
+
+ * bitops.h: Add #define's for ext2fs_{l,b}e{32,16}_to_cpu and
+ ext2fs_cpu_to_{l,b}e{32,16}
+
2002-06-27 Theodore Ts'o <tytso@mit.edu>
* ismounted.c (check_mntent): In AIX 4.3, MOUNTED isn't defined.
diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h
index cb04453c..6628d76d 100644
--- a/lib/ext2fs/bitops.h
+++ b/lib/ext2fs/bitops.h
@@ -20,6 +20,26 @@ extern int ext2fs_test_bit(int nr, const void * addr);
extern __u16 ext2fs_swab16(__u16 val);
extern __u32 ext2fs_swab32(__u32 val);
+#ifdef WORDS_BIGENDIAN
+#define ext2fs_cpu_to_le32(x) ext2fs_swab32((x))
+#define ext2fs_le32_to_cpu(x) ext2fs_swab32((x))
+#define ext2fs_cpu_to_le16(x) ext2fs_swab16((x))
+#define ext2fs_le16_to_cpu(x) ext2fs_swab16((x))
+#define ext2fs_cpu_to_be32(x) ((__u32)(x))
+#define ext2fs_be32_to_cpu(x) ((__u32)(x))
+#define ext2fs_cpu_to_be16(x) ((__u16)(x))
+#define ext2fs_be16_to_cpu(x) ((__u16)(x))
+#else
+#define ext2fs_cpu_to_le32(x) ((__u32)(x))
+#define ext2fs_le32_to_cpu(x) ((__u32)(x))
+#define ext2fs_cpu_to_le16(x) ((__u16)(x))
+#define ext2fs_le16_to_cpu(x) ((__u16)(x))
+#define ext2fs_cpu_to_be32(x) ext2fs_swab32((x))
+#define ext2fs_be32_to_cpu(x) ext2fs_swab32((x))
+#define ext2fs_cpu_to_be16(x) ext2fs_swab16((x))
+#define ext2fs_be16_to_cpu(x) ext2fs_swab16((x))
+#endif
+
/*
* EXT2FS bitmap manipulation routines.
*/