]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/swab.h
byteorder: only use linux/swab.h
[net-next-2.6.git] / include / linux / swab.h
index bbed279f3b32b53ff90dde829a8380fa0f8f768f..9a2d33e0a98abeb5f8550e4d960549c8dd21ce57 100644 (file)
@@ -9,17 +9,17 @@
  * 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 __const_swab16(x) ((__u16)(                            \
+#define ___constant_swab16(x) ((__u16)(                                \
        (((__u16)(x) & (__u16)0x00ffU) << 8) |                  \
        (((__u16)(x) & (__u16)0xff00U) >> 8)))
 
-#define __const_swab32(x) ((__u32)(                            \
+#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 __const_swab64(x) ((__u64)(                            \
+#define ___constant_swab64(x) ((__u64)(                                \
        (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) |   \
        (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) |   \
        (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) |   \
        (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) |   \
        (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
 
-#define __const_swahw32(x) ((__u32)(                           \
+#define ___constant_swahw32(x) ((__u32)(                       \
        (((__u32)(x) & (__u32)0x0000ffffUL) << 16) |            \
        (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
 
-#define __const_swahb32(x) ((__u32)(                           \
+#define ___constant_swahb32(x) ((__u32)(                       \
        (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) |             \
        (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
 
  * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
  */
 
-static inline __attribute_const__ __u16 ___swab16(__u16 val)
+static inline __attribute_const__ __u16 __fswab16(__u16 val)
 {
 #ifdef __arch_swab16
        return __arch_swab16(val);
 #else
-       return __const_swab16(val);
+       return ___constant_swab16(val);
 #endif
 }
 
-static inline __attribute_const__ __u32 ___swab32(__u32 val)
+static inline __attribute_const__ __u32 __fswab32(__u32 val)
 {
 #ifdef __arch_swab32
        return __arch_swab32(val);
 #else
-       return __const_swab32(val);
+       return ___constant_swab32(val);
 #endif
 }
 
-static inline __attribute_const__ __u64 ___swab64(__u64 val)
+static inline __attribute_const__ __u64 __fswab64(__u64 val)
 {
 #ifdef __arch_swab64
        return __arch_swab64(val);
@@ -70,25 +70,25 @@ static inline __attribute_const__ __u64 ___swab64(__u64 val)
        __u32 l = val & ((1ULL << 32) - 1);
        return (((__u64)___swab32(l)) << 32) | ((__u64)(___swab32(h)));
 #else
-       return __const_swab64(val);
+       return ___constant_swab64(val);
 #endif
 }
 
-static inline __attribute_const__ __u32 ___swahw32(__u32 val)
+static inline __attribute_const__ __u32 __fswahw32(__u32 val)
 {
 #ifdef __arch_swahw32
        return __arch_swahw32(val);
 #else
-       return __const_swahw32(val);
+       return ___constant_swahw32(val);
 #endif
 }
 
-static inline __attribute_const__ __u32 ___swahb32(__u32 val)
+static inline __attribute_const__ __u32 __fswahb32(__u32 val)
 {
 #ifdef __arch_swahb32
        return __arch_swahb32(val);
 #else
-       return __const_swahb32(val);
+       return ___constant_swahb32(val);
 #endif
 }
 
@@ -98,8 +98,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
  */
 #define __swab16(x)                            \
        (__builtin_constant_p((__u16)(x)) ?     \
-       __const_swab16((x)) :                   \
-       ___swab16((x)))
+       ___constant_swab16(x) :                 \
+       __fswab16(x))
 
 /**
  * __swab32 - return a byteswapped 32-bit value
@@ -107,8 +107,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
  */
 #define __swab32(x)                            \
        (__builtin_constant_p((__u32)(x)) ?     \
-       __const_swab32((x)) :                   \
-       ___swab32((x)))
+       ___constant_swab32(x) :                 \
+       __fswab32(x))
 
 /**
  * __swab64 - return a byteswapped 64-bit value
@@ -116,8 +116,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
  */
 #define __swab64(x)                            \
        (__builtin_constant_p((__u64)(x)) ?     \
-       __const_swab64((x)) :                   \
-       ___swab64((x)))
+       ___constant_swab64(x) :                 \
+       __fswab64(x))
 
 /**
  * __swahw32 - return a word-swapped 32-bit value
@@ -127,8 +127,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
  */
 #define __swahw32(x)                           \
        (__builtin_constant_p((__u32)(x)) ?     \
-       __const_swahw32((x)) :                  \
-       ___swahw32((x)))
+       ___constant_swahw32(x) :                \
+       __fswahw32(x))
 
 /**
  * __swahb32 - return a high and low byte-swapped 32-bit value
@@ -138,8 +138,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
  */
 #define __swahb32(x)                           \
        (__builtin_constant_p((__u32)(x)) ?     \
-       __const_swahb32((x)) :                  \
-       ___swahb32((x)))
+       ___constant_swahb32(x) :                \
+       __fswahb32(x))
 
 /**
  * __swab16p - return a byteswapped 16-bit value from a pointer