diff options
Diffstat (limited to 'include/linux/byteorder/swabb.h')
-rw-r--r-- | include/linux/byteorder/swabb.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h index ae5e5f914bf4..8c780c7d779e 100644 --- a/include/linux/byteorder/swabb.h +++ b/include/linux/byteorder/swabb.h | |||
@@ -25,6 +25,8 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/types.h> | ||
29 | |||
28 | #define ___swahw32(x) \ | 30 | #define ___swahw32(x) \ |
29 | ({ \ | 31 | ({ \ |
30 | __u32 __x = (x); \ | 32 | __u32 __x = (x); \ |
@@ -77,19 +79,14 @@ | |||
77 | /* | 79 | /* |
78 | * Allow constant folding | 80 | * Allow constant folding |
79 | */ | 81 | */ |
80 | #if defined(__GNUC__) && defined(__OPTIMIZE__) | 82 | #define __swahw32(x) \ |
81 | # define __swahw32(x) \ | ||
82 | (__builtin_constant_p((__u32)(x)) ? \ | 83 | (__builtin_constant_p((__u32)(x)) ? \ |
83 | ___swahw32((x)) : \ | 84 | ___swahw32((x)) : \ |
84 | __fswahw32((x))) | 85 | __fswahw32((x))) |
85 | # define __swahb32(x) \ | 86 | #define __swahb32(x) \ |
86 | (__builtin_constant_p((__u32)(x)) ? \ | 87 | (__builtin_constant_p((__u32)(x)) ? \ |
87 | ___swahb32((x)) : \ | 88 | ___swahb32((x)) : \ |
88 | __fswahb32((x))) | 89 | __fswahb32((x))) |
89 | #else | ||
90 | # define __swahw32(x) __fswahw32(x) | ||
91 | # define __swahb32(x) __fswahb32(x) | ||
92 | #endif /* OPTIMIZE */ | ||
93 | 90 | ||
94 | 91 | ||
95 | static inline __u32 __fswahw32(__u32 x) | 92 | static inline __u32 __fswahw32(__u32 x) |
@@ -128,13 +125,11 @@ static inline void __swahb32s(__u32 *addr) | |||
128 | */ | 125 | */ |
129 | #endif /* __BYTEORDER_HAS_U64__ */ | 126 | #endif /* __BYTEORDER_HAS_U64__ */ |
130 | 127 | ||
131 | #if defined(__KERNEL__) | ||
132 | #define swahw32 __swahw32 | 128 | #define swahw32 __swahw32 |
133 | #define swahb32 __swahb32 | 129 | #define swahb32 __swahb32 |
134 | #define swahw32p __swahw32p | 130 | #define swahw32p __swahw32p |
135 | #define swahb32p __swahb32p | 131 | #define swahb32p __swahb32p |
136 | #define swahw32s __swahw32s | 132 | #define swahw32s __swahw32s |
137 | #define swahb32s __swahb32s | 133 | #define swahb32s __swahb32s |
138 | #endif | ||
139 | 134 | ||
140 | #endif /* _LINUX_BYTEORDER_SWABB_H */ | 135 | #endif /* _LINUX_BYTEORDER_SWABB_H */ |