[PATCH] fix semaphore handling in __unregister_chrdev_region
[linux/fpc-iii.git] / sound / core / oss / plugin_ops.h
blob0607e956608471c4bfe5748a658a964d237cea09
1 /*
2 * Plugin sample operators with fast switch
3 * Copyright (c) 2000 by Jaroslav Kysela <perex@suse.cz>
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Library General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #define as_u8(ptr) (*(u_int8_t*)(ptr))
24 #define as_u16(ptr) (*(u_int16_t*)(ptr))
25 #define as_u32(ptr) (*(u_int32_t*)(ptr))
26 #define as_u64(ptr) (*(u_int64_t*)(ptr))
27 #define as_s8(ptr) (*(int8_t*)(ptr))
28 #define as_s16(ptr) (*(int16_t*)(ptr))
29 #define as_s32(ptr) (*(int32_t*)(ptr))
30 #define as_s64(ptr) (*(int64_t*)(ptr))
32 #ifdef COPY_LABELS
33 static void *copy_labels[4] = {
34 &&copy_8,
35 &&copy_16,
36 &&copy_32,
37 &&copy_64
39 #endif
41 #ifdef COPY_END
42 while(0) {
43 copy_8: as_s8(dst) = as_s8(src); goto COPY_END;
44 copy_16: as_s16(dst) = as_s16(src); goto COPY_END;
45 copy_32: as_s32(dst) = as_s32(src); goto COPY_END;
46 copy_64: as_s64(dst) = as_s64(src); goto COPY_END;
48 #endif
50 #ifdef CONV_LABELS
51 /* src_wid src_endswap sign_toggle dst_wid dst_endswap */
52 static void *conv_labels[4 * 2 * 2 * 4 * 2] = {
53 &&conv_xxx1_xxx1, /* 8h -> 8h */
54 &&conv_xxx1_xxx1, /* 8h -> 8s */
55 &&conv_xxx1_xx10, /* 8h -> 16h */
56 &&conv_xxx1_xx01, /* 8h -> 16s */
57 &&conv_xxx1_x100, /* 8h -> 24h */
58 &&conv_xxx1_001x, /* 8h -> 24s */
59 &&conv_xxx1_1000, /* 8h -> 32h */
60 &&conv_xxx1_0001, /* 8h -> 32s */
61 &&conv_xxx1_xxx9, /* 8h ^> 8h */
62 &&conv_xxx1_xxx9, /* 8h ^> 8s */
63 &&conv_xxx1_xx90, /* 8h ^> 16h */
64 &&conv_xxx1_xx09, /* 8h ^> 16s */
65 &&conv_xxx1_x900, /* 8h ^> 24h */
66 &&conv_xxx1_009x, /* 8h ^> 24s */
67 &&conv_xxx1_9000, /* 8h ^> 32h */
68 &&conv_xxx1_0009, /* 8h ^> 32s */
69 &&conv_xxx1_xxx1, /* 8s -> 8h */
70 &&conv_xxx1_xxx1, /* 8s -> 8s */
71 &&conv_xxx1_xx10, /* 8s -> 16h */
72 &&conv_xxx1_xx01, /* 8s -> 16s */
73 &&conv_xxx1_x100, /* 8s -> 24h */
74 &&conv_xxx1_001x, /* 8s -> 24s */
75 &&conv_xxx1_1000, /* 8s -> 32h */
76 &&conv_xxx1_0001, /* 8s -> 32s */
77 &&conv_xxx1_xxx9, /* 8s ^> 8h */
78 &&conv_xxx1_xxx9, /* 8s ^> 8s */
79 &&conv_xxx1_xx90, /* 8s ^> 16h */
80 &&conv_xxx1_xx09, /* 8s ^> 16s */
81 &&conv_xxx1_x900, /* 8s ^> 24h */
82 &&conv_xxx1_009x, /* 8s ^> 24s */
83 &&conv_xxx1_9000, /* 8s ^> 32h */
84 &&conv_xxx1_0009, /* 8s ^> 32s */
85 &&conv_xx12_xxx1, /* 16h -> 8h */
86 &&conv_xx12_xxx1, /* 16h -> 8s */
87 &&conv_xx12_xx12, /* 16h -> 16h */
88 &&conv_xx12_xx21, /* 16h -> 16s */
89 &&conv_xx12_x120, /* 16h -> 24h */
90 &&conv_xx12_021x, /* 16h -> 24s */
91 &&conv_xx12_1200, /* 16h -> 32h */
92 &&conv_xx12_0021, /* 16h -> 32s */
93 &&conv_xx12_xxx9, /* 16h ^> 8h */
94 &&conv_xx12_xxx9, /* 16h ^> 8s */
95 &&conv_xx12_xx92, /* 16h ^> 16h */
96 &&conv_xx12_xx29, /* 16h ^> 16s */
97 &&conv_xx12_x920, /* 16h ^> 24h */
98 &&conv_xx12_029x, /* 16h ^> 24s */
99 &&conv_xx12_9200, /* 16h ^> 32h */
100 &&conv_xx12_0029, /* 16h ^> 32s */
101 &&conv_xx12_xxx2, /* 16s -> 8h */
102 &&conv_xx12_xxx2, /* 16s -> 8s */
103 &&conv_xx12_xx21, /* 16s -> 16h */
104 &&conv_xx12_xx12, /* 16s -> 16s */
105 &&conv_xx12_x210, /* 16s -> 24h */
106 &&conv_xx12_012x, /* 16s -> 24s */
107 &&conv_xx12_2100, /* 16s -> 32h */
108 &&conv_xx12_0012, /* 16s -> 32s */
109 &&conv_xx12_xxxA, /* 16s ^> 8h */
110 &&conv_xx12_xxxA, /* 16s ^> 8s */
111 &&conv_xx12_xxA1, /* 16s ^> 16h */
112 &&conv_xx12_xx1A, /* 16s ^> 16s */
113 &&conv_xx12_xA10, /* 16s ^> 24h */
114 &&conv_xx12_01Ax, /* 16s ^> 24s */
115 &&conv_xx12_A100, /* 16s ^> 32h */
116 &&conv_xx12_001A, /* 16s ^> 32s */
117 &&conv_x123_xxx1, /* 24h -> 8h */
118 &&conv_x123_xxx1, /* 24h -> 8s */
119 &&conv_x123_xx12, /* 24h -> 16h */
120 &&conv_x123_xx21, /* 24h -> 16s */
121 &&conv_x123_x123, /* 24h -> 24h */
122 &&conv_x123_321x, /* 24h -> 24s */
123 &&conv_x123_1230, /* 24h -> 32h */
124 &&conv_x123_0321, /* 24h -> 32s */
125 &&conv_x123_xxx9, /* 24h ^> 8h */
126 &&conv_x123_xxx9, /* 24h ^> 8s */
127 &&conv_x123_xx92, /* 24h ^> 16h */
128 &&conv_x123_xx29, /* 24h ^> 16s */
129 &&conv_x123_x923, /* 24h ^> 24h */
130 &&conv_x123_329x, /* 24h ^> 24s */
131 &&conv_x123_9230, /* 24h ^> 32h */
132 &&conv_x123_0329, /* 24h ^> 32s */
133 &&conv_123x_xxx3, /* 24s -> 8h */
134 &&conv_123x_xxx3, /* 24s -> 8s */
135 &&conv_123x_xx32, /* 24s -> 16h */
136 &&conv_123x_xx23, /* 24s -> 16s */
137 &&conv_123x_x321, /* 24s -> 24h */
138 &&conv_123x_123x, /* 24s -> 24s */
139 &&conv_123x_3210, /* 24s -> 32h */
140 &&conv_123x_0123, /* 24s -> 32s */
141 &&conv_123x_xxxB, /* 24s ^> 8h */
142 &&conv_123x_xxxB, /* 24s ^> 8s */
143 &&conv_123x_xxB2, /* 24s ^> 16h */
144 &&conv_123x_xx2B, /* 24s ^> 16s */
145 &&conv_123x_xB21, /* 24s ^> 24h */
146 &&conv_123x_12Bx, /* 24s ^> 24s */
147 &&conv_123x_B210, /* 24s ^> 32h */
148 &&conv_123x_012B, /* 24s ^> 32s */
149 &&conv_1234_xxx1, /* 32h -> 8h */
150 &&conv_1234_xxx1, /* 32h -> 8s */
151 &&conv_1234_xx12, /* 32h -> 16h */
152 &&conv_1234_xx21, /* 32h -> 16s */
153 &&conv_1234_x123, /* 32h -> 24h */
154 &&conv_1234_321x, /* 32h -> 24s */
155 &&conv_1234_1234, /* 32h -> 32h */
156 &&conv_1234_4321, /* 32h -> 32s */
157 &&conv_1234_xxx9, /* 32h ^> 8h */
158 &&conv_1234_xxx9, /* 32h ^> 8s */
159 &&conv_1234_xx92, /* 32h ^> 16h */
160 &&conv_1234_xx29, /* 32h ^> 16s */
161 &&conv_1234_x923, /* 32h ^> 24h */
162 &&conv_1234_329x, /* 32h ^> 24s */
163 &&conv_1234_9234, /* 32h ^> 32h */
164 &&conv_1234_4329, /* 32h ^> 32s */
165 &&conv_1234_xxx4, /* 32s -> 8h */
166 &&conv_1234_xxx4, /* 32s -> 8s */
167 &&conv_1234_xx43, /* 32s -> 16h */
168 &&conv_1234_xx34, /* 32s -> 16s */
169 &&conv_1234_x432, /* 32s -> 24h */
170 &&conv_1234_234x, /* 32s -> 24s */
171 &&conv_1234_4321, /* 32s -> 32h */
172 &&conv_1234_1234, /* 32s -> 32s */
173 &&conv_1234_xxxC, /* 32s ^> 8h */
174 &&conv_1234_xxxC, /* 32s ^> 8s */
175 &&conv_1234_xxC3, /* 32s ^> 16h */
176 &&conv_1234_xx3C, /* 32s ^> 16s */
177 &&conv_1234_xC32, /* 32s ^> 24h */
178 &&conv_1234_23Cx, /* 32s ^> 24s */
179 &&conv_1234_C321, /* 32s ^> 32h */
180 &&conv_1234_123C, /* 32s ^> 32s */
182 #endif
184 #ifdef CONV_END
185 while(0) {
186 conv_xxx1_xxx1: as_u8(dst) = as_u8(src); goto CONV_END;
187 conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8(src) << 8; goto CONV_END;
188 conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8(src); goto CONV_END;
189 conv_xxx1_x100: as_u32(dst) = (u_int32_t)as_u8(src) << 16; goto CONV_END;
190 conv_xxx1_001x: as_u32(dst) = (u_int32_t)as_u8(src) << 8; goto CONV_END;
191 conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8(src) << 24; goto CONV_END;
192 conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8(src); goto CONV_END;
193 conv_xxx1_xxx9: as_u8(dst) = as_u8(src) ^ 0x80; goto CONV_END;
194 conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8(src) ^ 0x80) << 8; goto CONV_END;
195 conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8(src) ^ 0x80); goto CONV_END;
196 conv_xxx1_x900: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 16; goto CONV_END;
197 conv_xxx1_009x: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 8; goto CONV_END;
198 conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 24; goto CONV_END;
199 conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80); goto CONV_END;
200 conv_xx12_xxx1: as_u8(dst) = as_u16(src) >> 8; goto CONV_END;
201 conv_xx12_xx12: as_u16(dst) = as_u16(src); goto CONV_END;
202 conv_xx12_xx21: as_u16(dst) = swab16(as_u16(src)); goto CONV_END;
203 conv_xx12_x120: as_u32(dst) = (u_int32_t)as_u16(src) << 8; goto CONV_END;
204 conv_xx12_021x: as_u32(dst) = (u_int32_t)swab16(as_u16(src)) << 8; goto CONV_END;
205 conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16(src) << 16; goto CONV_END;
206 conv_xx12_0021: as_u32(dst) = (u_int32_t)swab16(as_u16(src)); goto CONV_END;
207 conv_xx12_xxx9: as_u8(dst) = (as_u16(src) >> 8) ^ 0x80; goto CONV_END;
208 conv_xx12_xx92: as_u16(dst) = as_u16(src) ^ 0x8000; goto CONV_END;
209 conv_xx12_xx29: as_u16(dst) = swab16(as_u16(src)) ^ 0x80; goto CONV_END;
210 conv_xx12_x920: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x8000) << 8; goto CONV_END;
211 conv_xx12_029x: as_u32(dst) = (u_int32_t)(swab16(as_u16(src)) ^ 0x80) << 8; goto CONV_END;
212 conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x8000) << 16; goto CONV_END;
213 conv_xx12_0029: as_u32(dst) = (u_int32_t)(swab16(as_u16(src)) ^ 0x80); goto CONV_END;
214 conv_xx12_xxx2: as_u8(dst) = as_u16(src) & 0xff; goto CONV_END;
215 conv_xx12_x210: as_u32(dst) = (u_int32_t)swab16(as_u16(src)) << 8; goto CONV_END;
216 conv_xx12_012x: as_u32(dst) = (u_int32_t)as_u16(src) << 8; goto CONV_END;
217 conv_xx12_2100: as_u32(dst) = (u_int32_t)swab16(as_u16(src)) << 16; goto CONV_END;
218 conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16(src); goto CONV_END;
219 conv_xx12_xxxA: as_u8(dst) = (as_u16(src) ^ 0x80) & 0xff; goto CONV_END;
220 conv_xx12_xxA1: as_u16(dst) = swab16(as_u16(src) ^ 0x80); goto CONV_END;
221 conv_xx12_xx1A: as_u16(dst) = as_u16(src) ^ 0x80; goto CONV_END;
222 conv_xx12_xA10: as_u32(dst) = (u_int32_t)swab16(as_u16(src) ^ 0x80) << 8; goto CONV_END;
223 conv_xx12_01Ax: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x80) << 8; goto CONV_END;
224 conv_xx12_A100: as_u32(dst) = (u_int32_t)swab16(as_u16(src) ^ 0x80) << 16; goto CONV_END;
225 conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x80); goto CONV_END;
226 conv_x123_xxx1: as_u8(dst) = as_u32(src) >> 16; goto CONV_END;
227 conv_x123_xx12: as_u16(dst) = as_u32(src) >> 8; goto CONV_END;
228 conv_x123_xx21: as_u16(dst) = swab16(as_u32(src) >> 8); goto CONV_END;
229 conv_x123_x123: as_u32(dst) = as_u32(src); goto CONV_END;
230 conv_x123_321x: as_u32(dst) = swab32(as_u32(src)); goto CONV_END;
231 conv_x123_1230: as_u32(dst) = as_u32(src) << 8; goto CONV_END;
232 conv_x123_0321: as_u32(dst) = swab32(as_u32(src)) >> 8; goto CONV_END;
233 conv_x123_xxx9: as_u8(dst) = (as_u32(src) >> 16) ^ 0x80; goto CONV_END;
234 conv_x123_xx92: as_u16(dst) = (as_u32(src) >> 8) ^ 0x8000; goto CONV_END;
235 conv_x123_xx29: as_u16(dst) = swab16(as_u32(src) >> 8) ^ 0x80; goto CONV_END;
236 conv_x123_x923: as_u32(dst) = as_u32(src) ^ 0x800000; goto CONV_END;
237 conv_x123_329x: as_u32(dst) = swab32(as_u32(src)) ^ 0x8000; goto CONV_END;
238 conv_x123_9230: as_u32(dst) = (as_u32(src) ^ 0x800000) << 8; goto CONV_END;
239 conv_x123_0329: as_u32(dst) = (swab32(as_u32(src)) >> 8) ^ 0x80; goto CONV_END;
240 conv_123x_xxx3: as_u8(dst) = (as_u32(src) >> 8) & 0xff; goto CONV_END;
241 conv_123x_xx32: as_u16(dst) = swab16(as_u32(src) >> 8); goto CONV_END;
242 conv_123x_xx23: as_u16(dst) = (as_u32(src) >> 8) & 0xffff; goto CONV_END;
243 conv_123x_x321: as_u32(dst) = swab32(as_u32(src)); goto CONV_END;
244 conv_123x_123x: as_u32(dst) = as_u32(src); goto CONV_END;
245 conv_123x_3210: as_u32(dst) = swab32(as_u32(src)) << 8; goto CONV_END;
246 conv_123x_0123: as_u32(dst) = as_u32(src) >> 8; goto CONV_END;
247 conv_123x_xxxB: as_u8(dst) = ((as_u32(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
248 conv_123x_xxB2: as_u16(dst) = swab16((as_u32(src) >> 8) ^ 0x80); goto CONV_END;
249 conv_123x_xx2B: as_u16(dst) = ((as_u32(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
250 conv_123x_xB21: as_u32(dst) = swab32(as_u32(src)) ^ 0x800000; goto CONV_END;
251 conv_123x_12Bx: as_u32(dst) = as_u32(src) ^ 0x8000; goto CONV_END;
252 conv_123x_B210: as_u32(dst) = swab32(as_u32(src) ^ 0x8000) << 8; goto CONV_END;
253 conv_123x_012B: as_u32(dst) = (as_u32(src) >> 8) ^ 0x80; goto CONV_END;
254 conv_1234_xxx1: as_u8(dst) = as_u32(src) >> 24; goto CONV_END;
255 conv_1234_xx12: as_u16(dst) = as_u32(src) >> 16; goto CONV_END;
256 conv_1234_xx21: as_u16(dst) = swab16(as_u32(src) >> 16); goto CONV_END;
257 conv_1234_x123: as_u32(dst) = as_u32(src) >> 8; goto CONV_END;
258 conv_1234_321x: as_u32(dst) = swab32(as_u32(src)) << 8; goto CONV_END;
259 conv_1234_1234: as_u32(dst) = as_u32(src); goto CONV_END;
260 conv_1234_4321: as_u32(dst) = swab32(as_u32(src)); goto CONV_END;
261 conv_1234_xxx9: as_u8(dst) = (as_u32(src) >> 24) ^ 0x80; goto CONV_END;
262 conv_1234_xx92: as_u16(dst) = (as_u32(src) >> 16) ^ 0x8000; goto CONV_END;
263 conv_1234_xx29: as_u16(dst) = swab16(as_u32(src) >> 16) ^ 0x80; goto CONV_END;
264 conv_1234_x923: as_u32(dst) = (as_u32(src) >> 8) ^ 0x800000; goto CONV_END;
265 conv_1234_329x: as_u32(dst) = (swab32(as_u32(src)) ^ 0x80) << 8; goto CONV_END;
266 conv_1234_9234: as_u32(dst) = as_u32(src) ^ 0x80000000; goto CONV_END;
267 conv_1234_4329: as_u32(dst) = swab32(as_u32(src)) ^ 0x80; goto CONV_END;
268 conv_1234_xxx4: as_u8(dst) = as_u32(src) & 0xff; goto CONV_END;
269 conv_1234_xx43: as_u16(dst) = swab16(as_u32(src)); goto CONV_END;
270 conv_1234_xx34: as_u16(dst) = as_u32(src) & 0xffff; goto CONV_END;
271 conv_1234_x432: as_u32(dst) = swab32(as_u32(src)) >> 8; goto CONV_END;
272 conv_1234_234x: as_u32(dst) = as_u32(src) << 8; goto CONV_END;
273 conv_1234_xxxC: as_u8(dst) = (as_u32(src) & 0xff) ^ 0x80; goto CONV_END;
274 conv_1234_xxC3: as_u16(dst) = swab16(as_u32(src) ^ 0x80); goto CONV_END;
275 conv_1234_xx3C: as_u16(dst) = (as_u32(src) & 0xffff) ^ 0x80; goto CONV_END;
276 conv_1234_xC32: as_u32(dst) = (swab32(as_u32(src)) >> 8) ^ 0x800000; goto CONV_END;
277 conv_1234_23Cx: as_u32(dst) = (as_u32(src) ^ 0x80) << 8; goto CONV_END;
278 conv_1234_C321: as_u32(dst) = swab32(as_u32(src) ^ 0x80); goto CONV_END;
279 conv_1234_123C: as_u32(dst) = as_u32(src) ^ 0x80; goto CONV_END;
281 #endif
283 #ifdef GET_S16_LABELS
284 /* src_wid src_endswap unsigned */
285 static void *get_s16_labels[4 * 2 * 2] = {
286 &&get_s16_xxx1_xx10, /* 8h -> 16h */
287 &&get_s16_xxx1_xx90, /* 8h ^> 16h */
288 &&get_s16_xxx1_xx10, /* 8s -> 16h */
289 &&get_s16_xxx1_xx90, /* 8s ^> 16h */
290 &&get_s16_xx12_xx12, /* 16h -> 16h */
291 &&get_s16_xx12_xx92, /* 16h ^> 16h */
292 &&get_s16_xx12_xx21, /* 16s -> 16h */
293 &&get_s16_xx12_xxA1, /* 16s ^> 16h */
294 &&get_s16_x123_xx12, /* 24h -> 16h */
295 &&get_s16_x123_xx92, /* 24h ^> 16h */
296 &&get_s16_123x_xx32, /* 24s -> 16h */
297 &&get_s16_123x_xxB2, /* 24s ^> 16h */
298 &&get_s16_1234_xx12, /* 32h -> 16h */
299 &&get_s16_1234_xx92, /* 32h ^> 16h */
300 &&get_s16_1234_xx43, /* 32s -> 16h */
301 &&get_s16_1234_xxC3, /* 32s ^> 16h */
303 #endif
305 #ifdef GET_S16_END
306 while(0) {
307 get_s16_xxx1_xx10: sample = (u_int16_t)as_u8(src) << 8; goto GET_S16_END;
308 get_s16_xxx1_xx90: sample = (u_int16_t)(as_u8(src) ^ 0x80) << 8; goto GET_S16_END;
309 get_s16_xx12_xx12: sample = as_u16(src); goto GET_S16_END;
310 get_s16_xx12_xx92: sample = as_u16(src) ^ 0x8000; goto GET_S16_END;
311 get_s16_xx12_xx21: sample = swab16(as_u16(src)); goto GET_S16_END;
312 get_s16_xx12_xxA1: sample = swab16(as_u16(src) ^ 0x80); goto GET_S16_END;
313 get_s16_x123_xx12: sample = as_u32(src) >> 8; goto GET_S16_END;
314 get_s16_x123_xx92: sample = (as_u32(src) >> 8) ^ 0x8000; goto GET_S16_END;
315 get_s16_123x_xx32: sample = swab16(as_u32(src) >> 8); goto GET_S16_END;
316 get_s16_123x_xxB2: sample = swab16((as_u32(src) >> 8) ^ 0x8000); goto GET_S16_END;
317 get_s16_1234_xx12: sample = as_u32(src) >> 16; goto GET_S16_END;
318 get_s16_1234_xx92: sample = (as_u32(src) >> 16) ^ 0x8000; goto GET_S16_END;
319 get_s16_1234_xx43: sample = swab16(as_u32(src)); goto GET_S16_END;
320 get_s16_1234_xxC3: sample = swab16(as_u32(src) ^ 0x80); goto GET_S16_END;
322 #endif
324 #ifdef PUT_S16_LABELS
325 /* dst_wid dst_endswap unsigned */
326 static void *put_s16_labels[4 * 2 * 2] = {
327 &&put_s16_xx12_xxx1, /* 16h -> 8h */
328 &&put_s16_xx12_xxx9, /* 16h ^> 8h */
329 &&put_s16_xx12_xxx1, /* 16h -> 8s */
330 &&put_s16_xx12_xxx9, /* 16h ^> 8s */
331 &&put_s16_xx12_xx12, /* 16h -> 16h */
332 &&put_s16_xx12_xx92, /* 16h ^> 16h */
333 &&put_s16_xx12_xx21, /* 16h -> 16s */
334 &&put_s16_xx12_xx29, /* 16h ^> 16s */
335 &&put_s16_xx12_x120, /* 16h -> 24h */
336 &&put_s16_xx12_x920, /* 16h ^> 24h */
337 &&put_s16_xx12_021x, /* 16h -> 24s */
338 &&put_s16_xx12_029x, /* 16h ^> 24s */
339 &&put_s16_xx12_1200, /* 16h -> 32h */
340 &&put_s16_xx12_9200, /* 16h ^> 32h */
341 &&put_s16_xx12_0021, /* 16h -> 32s */
342 &&put_s16_xx12_0029, /* 16h ^> 32s */
344 #endif
346 #ifdef PUT_S16_END
347 while (0) {
348 put_s16_xx12_xxx1: as_u8(dst) = sample >> 8; goto PUT_S16_END;
349 put_s16_xx12_xxx9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT_S16_END;
350 put_s16_xx12_xx12: as_u16(dst) = sample; goto PUT_S16_END;
351 put_s16_xx12_xx92: as_u16(dst) = sample ^ 0x8000; goto PUT_S16_END;
352 put_s16_xx12_xx21: as_u16(dst) = swab16(sample); goto PUT_S16_END;
353 put_s16_xx12_xx29: as_u16(dst) = swab16(sample) ^ 0x80; goto PUT_S16_END;
354 put_s16_xx12_x120: as_u32(dst) = (u_int32_t)sample << 8; goto PUT_S16_END;
355 put_s16_xx12_x920: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 8; goto PUT_S16_END;
356 put_s16_xx12_021x: as_u32(dst) = (u_int32_t)swab16(sample) << 8; goto PUT_S16_END;
357 put_s16_xx12_029x: as_u32(dst) = (u_int32_t)(swab16(sample) ^ 0x80) << 8; goto PUT_S16_END;
358 put_s16_xx12_1200: as_u32(dst) = (u_int32_t)sample << 16; goto PUT_S16_END;
359 put_s16_xx12_9200: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 16; goto PUT_S16_END;
360 put_s16_xx12_0021: as_u32(dst) = (u_int32_t)swab16(sample); goto PUT_S16_END;
361 put_s16_xx12_0029: as_u32(dst) = (u_int32_t)swab16(sample) ^ 0x80; goto PUT_S16_END;
363 #endif
365 #if 0
366 #ifdef GET32_LABELS
367 /* src_wid src_endswap unsigned */
368 static void *get32_labels[4 * 2 * 2] = {
369 &&get32_xxx1_1000, /* 8h -> 32h */
370 &&get32_xxx1_9000, /* 8h ^> 32h */
371 &&get32_xxx1_1000, /* 8s -> 32h */
372 &&get32_xxx1_9000, /* 8s ^> 32h */
373 &&get32_xx12_1200, /* 16h -> 32h */
374 &&get32_xx12_9200, /* 16h ^> 32h */
375 &&get32_xx12_2100, /* 16s -> 32h */
376 &&get32_xx12_A100, /* 16s ^> 32h */
377 &&get32_x123_1230, /* 24h -> 32h */
378 &&get32_x123_9230, /* 24h ^> 32h */
379 &&get32_123x_3210, /* 24s -> 32h */
380 &&get32_123x_B210, /* 24s ^> 32h */
381 &&get32_1234_1234, /* 32h -> 32h */
382 &&get32_1234_9234, /* 32h ^> 32h */
383 &&get32_1234_4321, /* 32s -> 32h */
384 &&get32_1234_C321, /* 32s ^> 32h */
386 #endif
388 #ifdef GET32_END
389 while (0) {
390 get32_xxx1_1000: sample = (u_int32_t)as_u8(src) << 24; goto GET32_END;
391 get32_xxx1_9000: sample = (u_int32_t)(as_u8(src) ^ 0x80) << 24; goto GET32_END;
392 get32_xx12_1200: sample = (u_int32_t)as_u16(src) << 16; goto GET32_END;
393 get32_xx12_9200: sample = (u_int32_t)(as_u16(src) ^ 0x8000) << 16; goto GET32_END;
394 get32_xx12_2100: sample = (u_int32_t)swab16(as_u16(src)) << 16; goto GET32_END;
395 get32_xx12_A100: sample = (u_int32_t)swab16(as_u16(src) ^ 0x80) << 16; goto GET32_END;
396 get32_x123_1230: sample = as_u32(src) << 8; goto GET32_END;
397 get32_x123_9230: sample = (as_u32(src) << 8) ^ 0x80000000; goto GET32_END;
398 get32_123x_3210: sample = swab32(as_u32(src) >> 8); goto GET32_END;
399 get32_123x_B210: sample = swab32((as_u32(src) >> 8) ^ 0x80); goto GET32_END;
400 get32_1234_1234: sample = as_u32(src); goto GET32_END;
401 get32_1234_9234: sample = as_u32(src) ^ 0x80000000; goto GET32_END;
402 get32_1234_4321: sample = swab32(as_u32(src)); goto GET32_END;
403 get32_1234_C321: sample = swab32(as_u32(src) ^ 0x80); goto GET32_END;
405 #endif
406 #endif
408 #ifdef PUT_U32_LABELS
409 /* dst_wid dst_endswap unsigned */
410 static void *put_u32_labels[4 * 2 * 2] = {
411 &&put_u32_1234_xxx9, /* u32h -> s8h */
412 &&put_u32_1234_xxx1, /* u32h -> u8h */
413 &&put_u32_1234_xxx9, /* u32h -> s8s */
414 &&put_u32_1234_xxx1, /* u32h -> u8s */
415 &&put_u32_1234_xx92, /* u32h -> s16h */
416 &&put_u32_1234_xx12, /* u32h -> u16h */
417 &&put_u32_1234_xx29, /* u32h -> s16s */
418 &&put_u32_1234_xx21, /* u32h -> u16s */
419 &&put_u32_1234_x923, /* u32h -> s24h */
420 &&put_u32_1234_x123, /* u32h -> u24h */
421 &&put_u32_1234_329x, /* u32h -> s24s */
422 &&put_u32_1234_321x, /* u32h -> u24s */
423 &&put_u32_1234_9234, /* u32h -> s32h */
424 &&put_u32_1234_1234, /* u32h -> u32h */
425 &&put_u32_1234_4329, /* u32h -> s32s */
426 &&put_u32_1234_4321, /* u32h -> u32s */
428 #endif
430 #ifdef PUT_U32_END
431 while (0) {
432 put_u32_1234_xxx1: as_u8(dst) = sample >> 24; goto PUT_U32_END;
433 put_u32_1234_xxx9: as_u8(dst) = (sample >> 24) ^ 0x80; goto PUT_U32_END;
434 put_u32_1234_xx12: as_u16(dst) = sample >> 16; goto PUT_U32_END;
435 put_u32_1234_xx92: as_u16(dst) = (sample >> 16) ^ 0x8000; goto PUT_U32_END;
436 put_u32_1234_xx21: as_u16(dst) = swab16(sample >> 16); goto PUT_U32_END;
437 put_u32_1234_xx29: as_u16(dst) = swab16(sample >> 16) ^ 0x80; goto PUT_U32_END;
438 put_u32_1234_x123: as_u32(dst) = sample >> 8; goto PUT_U32_END;
439 put_u32_1234_x923: as_u32(dst) = (sample >> 8) ^ 0x800000; goto PUT_U32_END;
440 put_u32_1234_321x: as_u32(dst) = swab32(sample) << 8; goto PUT_U32_END;
441 put_u32_1234_329x: as_u32(dst) = (swab32(sample) ^ 0x80) << 8; goto PUT_U32_END;
442 put_u32_1234_1234: as_u32(dst) = sample; goto PUT_U32_END;
443 put_u32_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT_U32_END;
444 put_u32_1234_4321: as_u32(dst) = swab32(sample); goto PUT_U32_END;
445 put_u32_1234_4329: as_u32(dst) = swab32(sample) ^ 0x80; goto PUT_U32_END;
447 #endif
449 #ifdef GET_U_LABELS
450 /* width endswap unsigned*/
451 static void *get_u_labels[4 * 2 * 2] = {
452 &&get_u_s8, /* s8 -> u8 */
453 &&get_u_u8, /* u8 -> u8 */
454 &&get_u_s8, /* s8 -> u8 */
455 &&get_u_u8, /* u8 -> u8 */
456 &&get_u_s16h, /* s16h -> u16h */
457 &&get_u_u16h, /* u16h -> u16h */
458 &&get_u_s16s, /* s16s -> u16h */
459 &&get_u_u16s, /* u16s -> u16h */
460 &&get_u_s24h, /* s24h -> u32h */
461 &&get_u_u24h, /* u24h -> u32h */
462 &&get_u_s24s, /* s24s -> u32h */
463 &&get_u_u24s, /* u24s -> u32h */
464 &&get_u_s32h, /* s32h -> u32h */
465 &&get_u_u32h, /* u32h -> u32h */
466 &&get_u_s32s, /* s32s -> u32h */
467 &&get_u_u32s, /* u32s -> u32h */
469 #endif
471 #ifdef GET_U_END
472 while (0) {
473 get_u_s8: sample = as_u8(src) ^ 0x80; goto GET_U_END;
474 get_u_u8: sample = as_u8(src); goto GET_U_END;
475 get_u_s16h: sample = as_u16(src) ^ 0x8000; goto GET_U_END;
476 get_u_u16h: sample = as_u16(src); goto GET_U_END;
477 get_u_s16s: sample = swab16(as_u16(src) ^ 0x80); goto GET_U_END;
478 get_u_u16s: sample = swab16(as_u16(src)); goto GET_U_END;
479 get_u_s24h: sample = (as_u32(src) ^ 0x800000); goto GET_U_END;
480 get_u_u24h: sample = as_u32(src); goto GET_U_END;
481 get_u_s24s: sample = swab32(as_u32(src) ^ 0x800000); goto GET_U_END;
482 get_u_u24s: sample = swab32(as_u32(src)); goto GET_U_END;
483 get_u_s32h: sample = as_u32(src) ^ 0x80000000; goto GET_U_END;
484 get_u_u32h: sample = as_u32(src); goto GET_U_END;
485 get_u_s32s: sample = swab32(as_u32(src) ^ 0x80); goto GET_U_END;
486 get_u_u32s: sample = swab32(as_u32(src)); goto GET_U_END;
488 #endif
490 #if 0
491 #ifdef PUT_LABELS
492 /* width endswap unsigned */
493 static void *put_labels[4 * 2 * 2] = {
494 &&put_s8, /* s8 -> s8 */
495 &&put_u8, /* u8 -> s8 */
496 &&put_s8, /* s8 -> s8 */
497 &&put_u8, /* u8 -> s8 */
498 &&put_s16h, /* s16h -> s16h */
499 &&put_u16h, /* u16h -> s16h */
500 &&put_s16s, /* s16s -> s16h */
501 &&put_u16s, /* u16s -> s16h */
502 &&put_s24h, /* s24h -> s32h */
503 &&put_u24h, /* u24h -> s32h */
504 &&put_s24s, /* s24s -> s32h */
505 &&put_u24s, /* u24s -> s32h */
506 &&put_s32h, /* s32h -> s32h */
507 &&put_u32h, /* u32h -> s32h */
508 &&put_s32s, /* s32s -> s32h */
509 &&put_u32s, /* u32s -> s32h */
511 #endif
513 #ifdef PUT_END
514 put_s8: as_s8(dst) = sample; goto PUT_END;
515 put_u8: as_u8(dst) = sample ^ 0x80; goto PUT_END;
516 put_s16h: as_s16(dst) = sample; goto PUT_END;
517 put_u16h: as_u16(dst) = sample ^ 0x8000; goto PUT_END;
518 put_s16s: as_s16(dst) = swab16(sample); goto PUT_END;
519 put_u16s: as_u16(dst) = swab16(sample ^ 0x80); goto PUT_END;
520 put_s24h: as_s24(dst) = sample & 0xffffff; goto PUT_END;
521 put_u24h: as_u24(dst) = sample ^ 0x80000000; goto PUT_END;
522 put_s24s: as_s24(dst) = swab32(sample & 0xffffff); goto PUT_END;
523 put_u24s: as_u24(dst) = swab32(sample ^ 0x80); goto PUT_END;
524 put_s32h: as_s32(dst) = sample; goto PUT_END;
525 put_u32h: as_u32(dst) = sample ^ 0x80000000; goto PUT_END;
526 put_s32s: as_s32(dst) = swab32(sample); goto PUT_END;
527 put_u32s: as_u32(dst) = swab32(sample ^ 0x80); goto PUT_END;
528 #endif
529 #endif
531 #undef as_u8
532 #undef as_u16
533 #undef as_u32
534 #undef as_s8
535 #undef as_s16
536 #undef as_s32