This source file includes following definitions.
- _transp
- get_mask
- transp8
- transp4
- transp4x
- comp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 static inline void _transp(u32 d[], unsigned int i1, unsigned int i2,
21 unsigned int shift, u32 mask)
22 {
23 u32 t = (d[i1] ^ (d[i2] >> shift)) & mask;
24
25 d[i1] ^= t;
26 d[i2] ^= t << shift;
27 }
28
29
30 extern void c2p_unsupported(void);
31
32 static __always_inline u32 get_mask(unsigned int n)
33 {
34 switch (n) {
35 case 1:
36 return 0x55555555;
37
38 case 2:
39 return 0x33333333;
40
41 case 4:
42 return 0x0f0f0f0f;
43
44 case 8:
45 return 0x00ff00ff;
46
47 case 16:
48 return 0x0000ffff;
49 }
50
51 c2p_unsupported();
52 return 0;
53 }
54
55
56
57
58
59
60 static __always_inline void transp8(u32 d[], unsigned int n, unsigned int m)
61 {
62 u32 mask = get_mask(n);
63
64 switch (m) {
65 case 1:
66
67 _transp(d, 0, 1, n, mask);
68
69 _transp(d, 2, 3, n, mask);
70
71 _transp(d, 4, 5, n, mask);
72
73 _transp(d, 6, 7, n, mask);
74 return;
75
76 case 2:
77
78 _transp(d, 0, 2, n, mask);
79 _transp(d, 1, 3, n, mask);
80
81 _transp(d, 4, 6, n, mask);
82 _transp(d, 5, 7, n, mask);
83 return;
84
85 case 4:
86
87 _transp(d, 0, 4, n, mask);
88 _transp(d, 1, 5, n, mask);
89 _transp(d, 2, 6, n, mask);
90 _transp(d, 3, 7, n, mask);
91 return;
92 }
93
94 c2p_unsupported();
95 }
96
97
98
99
100
101
102 static __always_inline void transp4(u32 d[], unsigned int n, unsigned int m)
103 {
104 u32 mask = get_mask(n);
105
106 switch (m) {
107 case 1:
108
109 _transp(d, 0, 1, n, mask);
110
111 _transp(d, 2, 3, n, mask);
112 return;
113
114 case 2:
115
116 _transp(d, 0, 2, n, mask);
117 _transp(d, 1, 3, n, mask);
118 return;
119 }
120
121 c2p_unsupported();
122 }
123
124
125
126
127
128
129 static __always_inline void transp4x(u32 d[], unsigned int n, unsigned int m)
130 {
131 u32 mask = get_mask(n);
132
133 switch (m) {
134 case 2:
135
136 _transp(d, 2, 0, n, mask);
137 _transp(d, 3, 1, n, mask);
138 return;
139 }
140
141 c2p_unsupported();
142 }
143
144
145
146
147
148
149
150 static inline u32 comp(u32 a, u32 b, u32 mask)
151 {
152 return ((a ^ b) & mask) ^ b;
153 }