Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
swab.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Analog Devices Inc.
3  *
4  * Licensed under the GPL-2 or later.
5  */
6 
7 #ifndef _BLACKFIN_SWAB_H
8 #define _BLACKFIN_SWAB_H
9 
10 #include <linux/types.h>
11 #include <asm-generic/swab.h>
12 
13 #ifdef __GNUC__
14 
16 {
17  __u32 tmp;
18  __asm__("%1 = %0 >> 8 (V);\n\t"
19  "%0 = %0 << 8 (V);\n\t"
20  "%0 = %0 | %1;\n\t"
21  : "+d"(xx), "=&d"(tmp));
22  return xx;
23 }
24 #define __arch_swahb32 __arch_swahb32
25 
27 {
28  __u32 rv;
29  __asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx));
30  return rv;
31 }
32 #define __arch_swahw32 __arch_swahw32
33 
35 {
36  return __arch_swahb32(__arch_swahw32(xx));
37 }
38 #define __arch_swab32 __arch_swab32
39 
41 {
42  __u32 xw = xx;
43  __asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw));
44  return (__u16)xw;
45 }
46 #define __arch_swab16 __arch_swab16
47 
48 #endif /* __GNUC__ */
49 
50 #endif /* _BLACKFIN_SWAB_H */