aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/swab.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/swab.h')
-rw-r--r--include/linux/swab.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/include/linux/swab.h b/include/linux/swab.h
index bbed279f3b32..be5284d4a053 100644
--- a/include/linux/swab.h
+++ b/include/linux/swab.h
@@ -9,17 +9,17 @@
9 * casts are necessary for constants, because we never know how for sure 9 * casts are necessary for constants, because we never know how for sure
10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. 10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
11 */ 11 */
12#define __const_swab16(x) ((__u16)( \ 12#define ___constant_swab16(x) ((__u16)( \
13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \ 13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
14 (((__u16)(x) & (__u16)0xff00U) >> 8))) 14 (((__u16)(x) & (__u16)0xff00U) >> 8)))
15 15
16#define __const_swab32(x) ((__u32)( \ 16#define ___constant_swab32(x) ((__u32)( \
17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ 17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ 18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ 19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
20 (((__u32)(x) & (__u32)0xff000000UL) >> 24))) 20 (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
21 21
22#define __const_swab64(x) ((__u64)( \ 22#define ___constant_swab64(x) ((__u64)( \
23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ 23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ 24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ 25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
@@ -29,11 +29,11 @@
29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ 29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) 30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
31 31
32#define __const_swahw32(x) ((__u32)( \ 32#define ___constant_swahw32(x) ((__u32)( \
33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ 33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) 34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
35 35
36#define __const_swahb32(x) ((__u32)( \ 36#define ___constant_swahb32(x) ((__u32)( \
37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ 37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) 38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
39 39
@@ -43,52 +43,52 @@
43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
44 */ 44 */
45 45
46static inline __attribute_const__ __u16 ___swab16(__u16 val) 46static inline __attribute_const__ __u16 __fswab16(__u16 val)
47{ 47{
48#ifdef __arch_swab16 48#ifdef __arch_swab16
49 return __arch_swab16(val); 49 return __arch_swab16(val);
50#else 50#else
51 return __const_swab16(val); 51 return ___constant_swab16(val);
52#endif 52#endif
53} 53}
54 54
55static inline __attribute_const__ __u32 ___swab32(__u32 val) 55static inline __attribute_const__ __u32 __fswab32(__u32 val)
56{ 56{
57#ifdef __arch_swab32 57#ifdef __arch_swab32
58 return __arch_swab32(val); 58 return __arch_swab32(val);
59#else 59#else
60 return __const_swab32(val); 60 return ___constant_swab32(val);
61#endif 61#endif
62} 62}
63 63
64static inline __attribute_const__ __u64 ___swab64(__u64 val) 64static inline __attribute_const__ __u64 __fswab64(__u64 val)
65{ 65{
66#ifdef __arch_swab64 66#ifdef __arch_swab64
67 return __arch_swab64(val); 67 return __arch_swab64(val);
68#elif defined(__SWAB_64_THRU_32__) 68#elif defined(__SWAB_64_THRU_32__)
69 __u32 h = val >> 32; 69 __u32 h = val >> 32;
70 __u32 l = val & ((1ULL << 32) - 1); 70 __u32 l = val & ((1ULL << 32) - 1);
71 return (((__u64)___swab32(l)) << 32) | ((__u64)(___swab32(h))); 71 return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h)));
72#else 72#else
73 return __const_swab64(val); 73 return ___constant_swab64(val);
74#endif 74#endif
75} 75}
76 76
77static inline __attribute_const__ __u32 ___swahw32(__u32 val) 77static inline __attribute_const__ __u32 __fswahw32(__u32 val)
78{ 78{
79#ifdef __arch_swahw32 79#ifdef __arch_swahw32
80 return __arch_swahw32(val); 80 return __arch_swahw32(val);
81#else 81#else
82 return __const_swahw32(val); 82 return ___constant_swahw32(val);
83#endif 83#endif
84} 84}
85 85
86static inline __attribute_const__ __u32 ___swahb32(__u32 val) 86static inline __attribute_const__ __u32 __fswahb32(__u32 val)
87{ 87{
88#ifdef __arch_swahb32 88#ifdef __arch_swahb32
89 return __arch_swahb32(val); 89 return __arch_swahb32(val);
90#else 90#else
91 return __const_swahb32(val); 91 return ___constant_swahb32(val);
92#endif 92#endif
93} 93}
94 94
@@ -98,8 +98,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
98 */ 98 */
99#define __swab16(x) \ 99#define __swab16(x) \
100 (__builtin_constant_p((__u16)(x)) ? \ 100 (__builtin_constant_p((__u16)(x)) ? \
101 __const_swab16((x)) : \ 101 ___constant_swab16(x) : \
102 ___swab16((x))) 102 __fswab16(x))
103 103
104/** 104/**
105 * __swab32 - return a byteswapped 32-bit value 105 * __swab32 - return a byteswapped 32-bit value
@@ -107,8 +107,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
107 */ 107 */
108#define __swab32(x) \ 108#define __swab32(x) \
109 (__builtin_constant_p((__u32)(x)) ? \ 109 (__builtin_constant_p((__u32)(x)) ? \
110 __const_swab32((x)) : \ 110 ___constant_swab32(x) : \
111 ___swab32((x))) 111 __fswab32(x))
112 112
113/** 113/**
114 * __swab64 - return a byteswapped 64-bit value 114 * __swab64 - return a byteswapped 64-bit value
@@ -116,8 +116,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
116 */ 116 */
117#define __swab64(x) \ 117#define __swab64(x) \
118 (__builtin_constant_p((__u64)(x)) ? \ 118 (__builtin_constant_p((__u64)(x)) ? \
119 __const_swab64((x)) : \ 119 ___constant_swab64(x) : \
120 ___swab64((x))) 120 __fswab64(x))
121 121
122/** 122/**
123 * __swahw32 - return a word-swapped 32-bit value 123 * __swahw32 - return a word-swapped 32-bit value
@@ -127,8 +127,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
127 */ 127 */
128#define __swahw32(x) \ 128#define __swahw32(x) \
129 (__builtin_constant_p((__u32)(x)) ? \ 129 (__builtin_constant_p((__u32)(x)) ? \
130 __const_swahw32((x)) : \ 130 ___constant_swahw32(x) : \
131 ___swahw32((x))) 131 __fswahw32(x))
132 132
133/** 133/**
134 * __swahb32 - return a high and low byte-swapped 32-bit value 134 * __swahb32 - return a high and low byte-swapped 32-bit value
@@ -138,8 +138,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
138 */ 138 */
139#define __swahb32(x) \ 139#define __swahb32(x) \
140 (__builtin_constant_p((__u32)(x)) ? \ 140 (__builtin_constant_p((__u32)(x)) ? \
141 __const_swahb32((x)) : \ 141 ___constant_swahb32(x) : \
142 ___swahb32((x))) 142 __fswahb32(x))
143 143
144/** 144/**
145 * __swab16p - return a byteswapped 16-bit value from a pointer 145 * __swab16p - return a byteswapped 16-bit value from a pointer