summaryrefslogtreecommitdiff
path: root/include/arch/x86_64/linux/swab.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/arch/x86_64/linux/swab.h')
-rw-r--r--include/arch/x86_64/linux/swab.h39
1 files changed, 13 insertions, 26 deletions
diff --git a/include/arch/x86_64/linux/swab.h b/include/arch/x86_64/linux/swab.h
index 2645a845..c416f8bd 100644
--- a/include/arch/x86_64/linux/swab.h
+++ b/include/arch/x86_64/linux/swab.h
@@ -11,15 +11,11 @@
* casts are necessary for constants, because we never know how for sure
* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
*/
-#define ___constant_swab16(x) \
- ((__u16)((((__u16)(x) & (__u16)0x00ffU) << 8) | \
- (((__u16)(x) & (__u16)0xff00U) >> 8)))
+#define ___constant_swab16(x) ((__u16)((((__u16)(x) & (__u16)0x00ffU) << 8) | (((__u16)(x) & (__u16)0xff00U) >> 8)))
-#define ___constant_swab32(x) \
- ((__u32)((((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
- (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
- (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
- (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
+#define ___constant_swab32(x) \
+ ((__u32)((((__u32)(x) & (__u32)0x000000ffUL) << 24) | (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
+ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
#define ___constant_swab64(x) \
((__u64)((((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
@@ -31,13 +27,11 @@
(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
-#define ___constant_swahw32(x) \
- ((__u32)((((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
- (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
+#define ___constant_swahw32(x) \
+ ((__u32)((((__u32)(x) & (__u32)0x0000ffffUL) << 16) | (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
-#define ___constant_swahb32(x) \
- ((__u32)((((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
- (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
+#define ___constant_swahb32(x) \
+ ((__u32)((((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
/*
* Implement the following as inlines, but define the interface using
@@ -101,8 +95,7 @@ static __inline__ __u32 __fswahb32(__u32 val)
#ifdef __HAVE_BUILTIN_BSWAP16__
#define __swab16(x) (__u16) __builtin_bswap16((__u16)(x))
#else
-#define __swab16(x) \
- (__u16)(__builtin_constant_p(x) ? ___constant_swab16(x) : __fswab16(x))
+#define __swab16(x) (__u16)(__builtin_constant_p(x) ? ___constant_swab16(x) : __fswab16(x))
#endif
/**
@@ -112,8 +105,7 @@ static __inline__ __u32 __fswahb32(__u32 val)
#ifdef __HAVE_BUILTIN_BSWAP32__
#define __swab32(x) (__u32) __builtin_bswap32((__u32)(x))
#else
-#define __swab32(x) \
- (__u32)(__builtin_constant_p(x) ? ___constant_swab32(x) : __fswab32(x))
+#define __swab32(x) (__u32)(__builtin_constant_p(x) ? ___constant_swab32(x) : __fswab32(x))
#endif
/**
@@ -123,8 +115,7 @@ static __inline__ __u32 __fswahb32(__u32 val)
#ifdef __HAVE_BUILTIN_BSWAP64__
#define __swab64(x) (__u64) __builtin_bswap64((__u64)(x))
#else
-#define __swab64(x) \
- (__u64)(__builtin_constant_p(x) ? ___constant_swab64(x) : __fswab64(x))
+#define __swab64(x) (__u64)(__builtin_constant_p(x) ? ___constant_swab64(x) : __fswab64(x))
#endif
static __always_inline unsigned long __swab(const unsigned long y)
@@ -142,9 +133,7 @@ static __always_inline unsigned long __swab(const unsigned long y)
*
* __swahw32(0x12340000) is 0x00001234
*/
-#define __swahw32(x) \
- (__builtin_constant_p((__u32)(x)) ? ___constant_swahw32(x) : \
- __fswahw32(x))
+#define __swahw32(x) (__builtin_constant_p((__u32)(x)) ? ___constant_swahw32(x) : __fswahw32(x))
/**
* __swahb32 - return a high and low byte-swapped 32-bit value
@@ -152,9 +141,7 @@ static __always_inline unsigned long __swab(const unsigned long y)
*
* __swahb32(0x12345678) is 0x34127856
*/
-#define __swahb32(x) \
- (__builtin_constant_p((__u32)(x)) ? ___constant_swahb32(x) : \
- __fswahb32(x))
+#define __swahb32(x) (__builtin_constant_p((__u32)(x)) ? ___constant_swahb32(x) : __fswahb32(x))
/**
* __swab16p - return a byteswapped 16-bit value from a pointer