summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2006-11-27 16:48:17 +0000
committerDenis Vlasenko2006-11-27 16:48:17 +0000
commit10d0d4eec7e3a292917f43f72afae20341d9ba11 (patch)
treeeb2f62d0756ae38bde76d61c15b9f3ddd3c41941
parent3ece72dc3f95d195924c760f9ee5059e35908564 (diff)
downloadbusybox-10d0d4eec7e3a292917f43f72afae20341d9ba11.zip
busybox-10d0d4eec7e3a292917f43f72afae20341d9ba11.tar.gz
byteswap ops had extra mask ops - removed
-rw-r--r--e2fsprogs/blkid/probe.h12
-rw-r--r--util-linux/fdisk.c14
-rw-r--r--util-linux/fdisk_sgi.c6
-rw-r--r--util-linux/fdisk_sun.c6
4 files changed, 17 insertions, 21 deletions
diff --git a/e2fsprogs/blkid/probe.h b/e2fsprogs/blkid/probe.h
index e1b6524..78f7964 100644
--- a/e2fsprogs/blkid/probe.h
+++ b/e2fsprogs/blkid/probe.h
@@ -327,8 +327,8 @@ _INLINE_ __u16 blkid_swab16(__u16 val)
_INLINE_ __u64 blkid_swab64(__u64 val)
{
- return (blkid_swab32(val >> 32) |
- (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
+ return blkid_swab32(val >> 32) |
+ ( ((__u64)blkid_swab32((__u32)val)) << 32 );
}
#endif
@@ -341,14 +341,14 @@ _INLINE_ __u16 blkid_swab16(__u16 val)
_INLINE_ __u32 blkid_swab32(__u32 val)
{
- return ((val>>24) | ((val>>8)&0xFF00) |
- ((val<<8)&0xFF0000) | (val<<24));
+ return (val>>24) | ((val>>8) & 0xFF00) |
+ ((val<<8) & 0xFF0000) | (val<<24);
}
_INLINE_ __u64 blkid_swab64(__u64 val)
{
- return (blkid_swab32(val >> 32) |
- (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32));
+ return blkid_swab32(val >> 32) |
+ ( ((__u64)blkid_swab32((__u32)val)) << 32 );
}
#endif
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 74c7710..07dac8b 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -379,19 +379,19 @@ STATIC_OSF void xbsd_print_disklabel(int);
#define SGI_XVM 0x0d
#define SGI_ENTIRE_DISK SGI_VOLUME
#if defined(CONFIG_FEATURE_SGI_LABEL) || defined(CONFIG_FEATURE_SUN_LABEL)
-static unsigned short
-__swap16(unsigned short x)
+static uint16_t
+__swap16(uint16_t x)
{
- return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8);
+ return (x << 8) | (x >> 8);
}
static uint32_t
__swap32(uint32_t x)
{
- return (((x & 0xFF) << 24) |
- ((x & 0xFF00) << 8) |
- ((x & 0xFF0000) >> 8) |
- ((x & 0xFF000000) >> 24));
+ return (x << 24) |
+ ((x & 0xFF00) << 8) |
+ ((x & 0xFF0000) >> 8) |
+ (x >> 24);
}
#endif
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index 9d444c0..548a70b 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -84,10 +84,8 @@ typedef struct {
#define SGI_INFO_MAGIC 0x00072959
#define SGI_INFO_MAGIC_SWAPPED 0x59290700
-#define SGI_SSWAP16(x) (sgi_other_endian ? __swap16(x) \
- : (uint16_t)(x))
-#define SGI_SSWAP32(x) (sgi_other_endian ? __swap32(x) \
- : (uint32_t)(x))
+#define SGI_SSWAP16(x) (sgi_other_endian ? __swap16(x) : (uint16_t)(x))
+#define SGI_SSWAP32(x) (sgi_other_endian ? __swap32(x) : (uint32_t)(x))
#define sgilabel ((sgi_partition *)MBRbuffer)
#define sgiparam (sgilabel->devparam)
diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c
index 6973fbf..1e8f2e5 100644
--- a/util-linux/fdisk_sun.c
+++ b/util-linux/fdisk_sun.c
@@ -2,10 +2,8 @@
#define SUN_LABEL_MAGIC 0xDABE
#define SUN_LABEL_MAGIC_SWAPPED 0xBEDA
-#define SUN_SSWAP16(x) (sun_other_endian ? __swap16(x) \
- : (uint16_t)(x))
-#define SUN_SSWAP32(x) (sun_other_endian ? __swap32(x) \
- : (uint32_t)(x))
+#define SUN_SSWAP16(x) (sun_other_endian ? __swap16(x) : (uint16_t)(x))
+#define SUN_SSWAP32(x) (sun_other_endian ? __swap32(x) : (uint32_t)(x))
/* Copied from linux/major.h */
#define FLOPPY_MAJOR 2