This source file includes following definitions.
- __arch_swab16
- __arch_swab24
- __arch_swab32
- __arch_swab64
1
2 #ifndef _PARISC_SWAB_H
3 #define _PARISC_SWAB_H
4
5 #include <asm/bitsperlong.h>
6 #include <linux/types.h>
7 #include <linux/compiler.h>
8
9 #define __SWAB_64_THRU_32__
10
11 static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
12 {
13 __asm__("dep %0, 15, 8, %0\n\t"
14 "shd %%r0, %0, 8, %0"
15 : "=r" (x)
16 : "0" (x));
17 return x;
18 }
19 #define __arch_swab16 __arch_swab16
20
21 static inline __attribute_const__ __u32 __arch_swab24(__u32 x)
22 {
23 __asm__("shd %0, %0, 8, %0\n\t"
24 "dep %0, 15, 8, %0\n\t"
25 "shd %%r0, %0, 8, %0"
26 : "=r" (x)
27 : "0" (x));
28 return x;
29 }
30
31 static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
32 {
33 unsigned int temp;
34 __asm__("shd %0, %0, 16, %1\n\t"
35 "dep %1, 15, 8, %1\n\t"
36 "shd %0, %1, 8, %0"
37 : "=r" (x), "=&r" (temp)
38 : "0" (x));
39 return x;
40 }
41 #define __arch_swab32 __arch_swab32
42
43 #if __BITS_PER_LONG > 32
44
45
46
47
48
49
50
51
52
53
54 static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
55 {
56 __u64 temp;
57 __asm__("permh,3210 %0, %0\n\t"
58 "hshl %0, 8, %1\n\t"
59 "hshr,u %0, 8, %0\n\t"
60 "or %1, %0, %0"
61 : "=r" (x), "=&r" (temp)
62 : "0" (x));
63 return x;
64 }
65 #define __arch_swab64 __arch_swab64
66 #endif
67
68 #endif