svn commit: trunk/busybox: e2fsprogs/blkid util-linux

vda at busybox.net vda at busybox.net
Mon Nov 27 16:48:19 UTC 2006


Author: vda
Date: 2006-11-27 08:48:17 -0800 (Mon, 27 Nov 2006)
New Revision: 16689

Log:
byteswap ops had extra mask ops - removed


Modified:
   trunk/busybox/e2fsprogs/blkid/probe.h
   trunk/busybox/util-linux/fdisk.c
   trunk/busybox/util-linux/fdisk_sgi.c
   trunk/busybox/util-linux/fdisk_sun.c


Changeset:
Modified: trunk/busybox/e2fsprogs/blkid/probe.h
===================================================================
--- trunk/busybox/e2fsprogs/blkid/probe.h	2006-11-27 15:25:32 UTC (rev 16688)
+++ trunk/busybox/e2fsprogs/blkid/probe.h	2006-11-27 16:48:17 UTC (rev 16689)
@@ -327,8 +327,8 @@
 
 _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_ __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
 

Modified: trunk/busybox/util-linux/fdisk.c
===================================================================
--- trunk/busybox/util-linux/fdisk.c	2006-11-27 15:25:32 UTC (rev 16688)
+++ trunk/busybox/util-linux/fdisk.c	2006-11-27 16:48:17 UTC (rev 16689)
@@ -379,19 +379,19 @@
 #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
 

Modified: trunk/busybox/util-linux/fdisk_sgi.c
===================================================================
--- trunk/busybox/util-linux/fdisk_sgi.c	2006-11-27 15:25:32 UTC (rev 16688)
+++ trunk/busybox/util-linux/fdisk_sgi.c	2006-11-27 16:48:17 UTC (rev 16689)
@@ -84,10 +84,8 @@
 #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)

Modified: trunk/busybox/util-linux/fdisk_sun.c
===================================================================
--- trunk/busybox/util-linux/fdisk_sun.c	2006-11-27 15:25:32 UTC (rev 16688)
+++ trunk/busybox/util-linux/fdisk_sun.c	2006-11-27 16:48:17 UTC (rev 16689)
@@ -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




More information about the busybox-cvs mailing list