ping locking
[cor_2_6_31.git] / arch / blackfin / include / asm / swab.h
blobd442113de515158f69ec6b4c7b0a3a31fc579fd0
1 #ifndef _BLACKFIN_SWAB_H
2 #define _BLACKFIN_SWAB_H
4 #include <linux/types.h>
5 #include <asm-generic/swab.h>
7 #ifdef __GNUC__
9 static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx)
11 __u32 tmp;
12 __asm__("%1 = %0 >> 8 (V);\n\t"
13 "%0 = %0 << 8 (V);\n\t"
14 "%0 = %0 | %1;\n\t"
15 : "+d"(xx), "=&d"(tmp));
16 return xx;
18 #define __arch_swahb32 __arch_swahb32
20 static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx)
22 __u32 rv;
23 __asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx));
24 return rv;
26 #define __arch_swahw32 __arch_swahw32
28 static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 xx)
30 return __arch_swahb32(__arch_swahw32(xx));
32 #define __arch_swab32 __arch_swab32
34 static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx)
36 __u32 xw = xx;
37 __asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw));
38 return (__u16)xw;
40 #define __arch_swab16 __arch_swab16
42 #endif /* __GNUC__ */
44 #endif /* _BLACKFIN_SWAB_H */