OSDN Git Service

Added GETS helpers, removed norm
[android-x86/external-alsa-lib.git] / src / pcm / plugin_ops.h
1 /*
2  *  Plugin sample operators with fast switch
3  *  Copyright (c) 2000 by Jaroslav Kysela <perex@suse.cz>
4  *
5  *
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.
10  *
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.
15  *
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., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */
21
22
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))
31
32 #define as_u8c(ptr) (*(const u_int8_t*)(ptr))
33 #define as_u16c(ptr) (*(const u_int16_t*)(ptr))
34 #define as_u32c(ptr) (*(const u_int32_t*)(ptr))
35 #define as_u64c(ptr) (*(const u_int64_t*)(ptr))
36 #define as_s8c(ptr) (*(const int8_t*)(ptr))
37 #define as_s16c(ptr) (*(const int16_t*)(ptr))
38 #define as_s32c(ptr) (*(const int32_t*)(ptr))
39 #define as_s64c(ptr) (*(const int64_t*)(ptr))
40
41 #ifdef COPY_LABELS
42 static void *copy_labels[4] = {
43         &&copy_8,
44         &&copy_16,
45         &&copy_32,
46         &&copy_64
47 };
48 #endif
49
50 #ifdef COPY_END
51 while(0) {
52 copy_8: as_s8(dst) = as_s8c(src); goto COPY_END;
53 copy_16: as_s16(dst) = as_s16c(src); goto COPY_END;
54 copy_32: as_s32(dst) = as_s32c(src); goto COPY_END;
55 copy_64: as_s64(dst) = as_s64c(src); goto COPY_END;
56 }
57 #endif
58
59 #ifdef CONV_LABELS
60 /* src_wid src_endswap sign_toggle dst_wid dst_endswap */
61 static void *conv_labels[4 * 2 * 2 * 4 * 2] = {
62         &&conv_xxx1_xxx1,        /*  8h ->  8h */
63         &&conv_xxx1_xxx1,        /*  8h ->  8s */
64         &&conv_xxx1_xx10,        /*  8h -> 16h */
65         &&conv_xxx1_xx01,        /*  8h -> 16s */
66         &&conv_xxx1_x100,        /*  8h -> 24h */
67         &&conv_xxx1_001x,        /*  8h -> 24s */
68         &&conv_xxx1_1000,        /*  8h -> 32h */
69         &&conv_xxx1_0001,        /*  8h -> 32s */
70         &&conv_xxx1_xxx9,        /*  8h ^>  8h */
71         &&conv_xxx1_xxx9,        /*  8h ^>  8s */
72         &&conv_xxx1_xx90,        /*  8h ^> 16h */
73         &&conv_xxx1_xx09,        /*  8h ^> 16s */
74         &&conv_xxx1_x900,        /*  8h ^> 24h */
75         &&conv_xxx1_009x,        /*  8h ^> 24s */
76         &&conv_xxx1_9000,        /*  8h ^> 32h */
77         &&conv_xxx1_0009,        /*  8h ^> 32s */
78         &&conv_xxx1_xxx1,        /*  8s ->  8h */
79         &&conv_xxx1_xxx1,        /*  8s ->  8s */
80         &&conv_xxx1_xx10,        /*  8s -> 16h */
81         &&conv_xxx1_xx01,        /*  8s -> 16s */
82         &&conv_xxx1_x100,        /*  8s -> 24h */
83         &&conv_xxx1_001x,        /*  8s -> 24s */
84         &&conv_xxx1_1000,        /*  8s -> 32h */
85         &&conv_xxx1_0001,        /*  8s -> 32s */
86         &&conv_xxx1_xxx9,        /*  8s ^>  8h */
87         &&conv_xxx1_xxx9,        /*  8s ^>  8s */
88         &&conv_xxx1_xx90,        /*  8s ^> 16h */
89         &&conv_xxx1_xx09,        /*  8s ^> 16s */
90         &&conv_xxx1_x900,        /*  8s ^> 24h */
91         &&conv_xxx1_009x,        /*  8s ^> 24s */
92         &&conv_xxx1_9000,        /*  8s ^> 32h */
93         &&conv_xxx1_0009,        /*  8s ^> 32s */
94         &&conv_xx12_xxx1,        /* 16h ->  8h */
95         &&conv_xx12_xxx1,        /* 16h ->  8s */
96         &&conv_xx12_xx12,        /* 16h -> 16h */
97         &&conv_xx12_xx21,        /* 16h -> 16s */
98         &&conv_xx12_x120,        /* 16h -> 24h */
99         &&conv_xx12_021x,        /* 16h -> 24s */
100         &&conv_xx12_1200,        /* 16h -> 32h */
101         &&conv_xx12_0021,        /* 16h -> 32s */
102         &&conv_xx12_xxx9,        /* 16h ^>  8h */
103         &&conv_xx12_xxx9,        /* 16h ^>  8s */
104         &&conv_xx12_xx92,        /* 16h ^> 16h */
105         &&conv_xx12_xx29,        /* 16h ^> 16s */
106         &&conv_xx12_x920,        /* 16h ^> 24h */
107         &&conv_xx12_029x,        /* 16h ^> 24s */
108         &&conv_xx12_9200,        /* 16h ^> 32h */
109         &&conv_xx12_0029,        /* 16h ^> 32s */
110         &&conv_xx12_xxx2,        /* 16s ->  8h */
111         &&conv_xx12_xxx2,        /* 16s ->  8s */
112         &&conv_xx12_xx21,        /* 16s -> 16h */
113         &&conv_xx12_xx12,        /* 16s -> 16s */
114         &&conv_xx12_x210,        /* 16s -> 24h */
115         &&conv_xx12_012x,        /* 16s -> 24s */
116         &&conv_xx12_2100,        /* 16s -> 32h */
117         &&conv_xx12_0012,        /* 16s -> 32s */
118         &&conv_xx12_xxxA,        /* 16s ^>  8h */
119         &&conv_xx12_xxxA,        /* 16s ^>  8s */
120         &&conv_xx12_xxA1,        /* 16s ^> 16h */
121         &&conv_xx12_xx1A,        /* 16s ^> 16s */
122         &&conv_xx12_xA10,        /* 16s ^> 24h */
123         &&conv_xx12_01Ax,        /* 16s ^> 24s */
124         &&conv_xx12_A100,        /* 16s ^> 32h */
125         &&conv_xx12_001A,        /* 16s ^> 32s */
126         &&conv_x123_xxx1,        /* 24h ->  8h */
127         &&conv_x123_xxx1,        /* 24h ->  8s */
128         &&conv_x123_xx12,        /* 24h -> 16h */
129         &&conv_x123_xx21,        /* 24h -> 16s */
130         &&conv_x123_x123,        /* 24h -> 24h */
131         &&conv_x123_321x,        /* 24h -> 24s */
132         &&conv_x123_1230,        /* 24h -> 32h */
133         &&conv_x123_0321,        /* 24h -> 32s */
134         &&conv_x123_xxx9,        /* 24h ^>  8h */
135         &&conv_x123_xxx9,        /* 24h ^>  8s */
136         &&conv_x123_xx92,        /* 24h ^> 16h */
137         &&conv_x123_xx29,        /* 24h ^> 16s */
138         &&conv_x123_x923,        /* 24h ^> 24h */
139         &&conv_x123_329x,        /* 24h ^> 24s */
140         &&conv_x123_9230,        /* 24h ^> 32h */
141         &&conv_x123_0329,        /* 24h ^> 32s */
142         &&conv_123x_xxx3,        /* 24s ->  8h */
143         &&conv_123x_xxx3,        /* 24s ->  8s */
144         &&conv_123x_xx32,        /* 24s -> 16h */
145         &&conv_123x_xx23,        /* 24s -> 16s */
146         &&conv_123x_x321,        /* 24s -> 24h */
147         &&conv_123x_123x,        /* 24s -> 24s */
148         &&conv_123x_3210,        /* 24s -> 32h */
149         &&conv_123x_0123,        /* 24s -> 32s */
150         &&conv_123x_xxxB,        /* 24s ^>  8h */
151         &&conv_123x_xxxB,        /* 24s ^>  8s */
152         &&conv_123x_xxB2,        /* 24s ^> 16h */
153         &&conv_123x_xx2B,        /* 24s ^> 16s */
154         &&conv_123x_xB21,        /* 24s ^> 24h */
155         &&conv_123x_12Bx,        /* 24s ^> 24s */
156         &&conv_123x_B210,        /* 24s ^> 32h */
157         &&conv_123x_012B,        /* 24s ^> 32s */
158         &&conv_1234_xxx1,        /* 32h ->  8h */
159         &&conv_1234_xxx1,        /* 32h ->  8s */
160         &&conv_1234_xx12,        /* 32h -> 16h */
161         &&conv_1234_xx21,        /* 32h -> 16s */
162         &&conv_1234_x123,        /* 32h -> 24h */
163         &&conv_1234_321x,        /* 32h -> 24s */
164         &&conv_1234_1234,        /* 32h -> 32h */
165         &&conv_1234_4321,        /* 32h -> 32s */
166         &&conv_1234_xxx9,        /* 32h ^>  8h */
167         &&conv_1234_xxx9,        /* 32h ^>  8s */
168         &&conv_1234_xx92,        /* 32h ^> 16h */
169         &&conv_1234_xx29,        /* 32h ^> 16s */
170         &&conv_1234_x923,        /* 32h ^> 24h */
171         &&conv_1234_329x,        /* 32h ^> 24s */
172         &&conv_1234_9234,        /* 32h ^> 32h */
173         &&conv_1234_4329,        /* 32h ^> 32s */
174         &&conv_1234_xxx4,        /* 32s ->  8h */
175         &&conv_1234_xxx4,        /* 32s ->  8s */
176         &&conv_1234_xx43,        /* 32s -> 16h */
177         &&conv_1234_xx34,        /* 32s -> 16s */
178         &&conv_1234_x432,        /* 32s -> 24h */
179         &&conv_1234_234x,        /* 32s -> 24s */
180         &&conv_1234_4321,        /* 32s -> 32h */
181         &&conv_1234_1234,        /* 32s -> 32s */
182         &&conv_1234_xxxC,        /* 32s ^>  8h */
183         &&conv_1234_xxxC,        /* 32s ^>  8s */
184         &&conv_1234_xxC3,        /* 32s ^> 16h */
185         &&conv_1234_xx3C,        /* 32s ^> 16s */
186         &&conv_1234_xC32,        /* 32s ^> 24h */
187         &&conv_1234_23Cx,        /* 32s ^> 24s */
188         &&conv_1234_C321,        /* 32s ^> 32h */
189         &&conv_1234_123C,        /* 32s ^> 32s */
190 };
191 #endif
192
193 #ifdef CONV_END
194 while(0) {
195 conv_xxx1_xxx1: as_u8(dst) = as_u8c(src); goto CONV_END;
196 conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8c(src) << 8; goto CONV_END;
197 conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8c(src); goto CONV_END;
198 conv_xxx1_x100: as_u32(dst) = (u_int32_t)as_u8c(src) << 16; goto CONV_END;
199 conv_xxx1_001x: as_u32(dst) = (u_int32_t)as_u8c(src) << 8; goto CONV_END;
200 conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8c(src) << 24; goto CONV_END;
201 conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8c(src); goto CONV_END;
202 conv_xxx1_xxx9: as_u8(dst) = as_u8c(src) ^ 0x80; goto CONV_END;
203 conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
204 conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80); goto CONV_END;
205 conv_xxx1_x900: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 16; goto CONV_END;
206 conv_xxx1_009x: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
207 conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END;
208 conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80); goto CONV_END;
209 conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END;
210 conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END;
211 conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END;
212 conv_xx12_x120: as_u32(dst) = (u_int32_t)as_u16c(src) << 8; goto CONV_END;
213 conv_xx12_021x: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 8; goto CONV_END;
214 conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16c(src) << 16; goto CONV_END;
215 conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)); goto CONV_END;
216 conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END;
217 conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END;
218 conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END;
219 conv_xx12_x920: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 8; goto CONV_END;
220 conv_xx12_029x: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8; goto CONV_END;
221 conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END;
222 conv_xx12_0029: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END;
223 conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END;
224 conv_xx12_x210: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 8; goto CONV_END;
225 conv_xx12_012x: as_u32(dst) = (u_int32_t)as_u16c(src) << 8; goto CONV_END;
226 conv_xx12_2100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END;
227 conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16c(src); goto CONV_END; 
228 conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END;
229 conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END;
230 conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END;
231 conv_xx12_xA10: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 8; goto CONV_END;
232 conv_xx12_01Ax: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80) << 8; goto CONV_END;
233 conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END;
234 conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80); goto CONV_END;
235 conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END;
236 conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END;
237 conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
238 conv_x123_x123: as_u32(dst) = as_u32c(src); goto CONV_END;
239 conv_x123_321x: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
240 conv_x123_1230: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
241 conv_x123_0321: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
242 conv_x123_xxx9: as_u8(dst) = (as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
243 conv_x123_xx92: as_u16(dst) = (as_u32c(src) >> 8) ^ 0x8000; goto CONV_END;
244 conv_x123_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
245 conv_x123_x923: as_u32(dst) = as_u32c(src) ^ 0x800000; goto CONV_END;
246 conv_x123_329x: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x8000; goto CONV_END;
247 conv_x123_9230: as_u32(dst) = (as_u32c(src) ^ 0x800000) << 8; goto CONV_END;
248 conv_x123_0329: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x80; goto CONV_END;
249 conv_123x_xxx3: as_u8(dst) = (as_u32c(src) >> 8) & 0xff; goto CONV_END;
250 conv_123x_xx32: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
251 conv_123x_xx23: as_u16(dst) = (as_u32c(src) >> 8) & 0xffff; goto CONV_END;
252 conv_123x_x321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
253 conv_123x_123x: as_u32(dst) = as_u32c(src); goto CONV_END;
254 conv_123x_3210: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
255 conv_123x_0123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
256 conv_123x_xxxB: as_u8(dst) = ((as_u32c(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
257 conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto CONV_END;
258 conv_123x_xx2B: as_u16(dst) = ((as_u32c(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
259 conv_123x_xB21: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x800000; goto CONV_END;
260 conv_123x_12Bx: as_u32(dst) = as_u32c(src) ^ 0x8000; goto CONV_END;
261 conv_123x_B210: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x8000) << 8; goto CONV_END;
262 conv_123x_012B: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
263 conv_1234_xxx1: as_u8(dst) = as_u32c(src) >> 24; goto CONV_END;
264 conv_1234_xx12: as_u16(dst) = as_u32c(src) >> 16; goto CONV_END;
265 conv_1234_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 16); goto CONV_END;
266 conv_1234_x123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
267 conv_1234_321x: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
268 conv_1234_1234: as_u32(dst) = as_u32c(src); goto CONV_END;
269 conv_1234_4321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
270 conv_1234_xxx9: as_u8(dst) = (as_u32c(src) >> 24) ^ 0x80; goto CONV_END;
271 conv_1234_xx92: as_u16(dst) = (as_u32c(src) >> 16) ^ 0x8000; goto CONV_END;
272 conv_1234_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
273 conv_1234_x923: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x800000; goto CONV_END;
274 conv_1234_329x: as_u32(dst) = (bswap_32(as_u32c(src)) ^ 0x80) << 8; goto CONV_END;
275 conv_1234_9234: as_u32(dst) = as_u32c(src) ^ 0x80000000; goto CONV_END;
276 conv_1234_4329: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x80; goto CONV_END;
277 conv_1234_xxx4: as_u8(dst) = as_u32c(src) & 0xff; goto CONV_END;
278 conv_1234_xx43: as_u16(dst) = bswap_16(as_u32c(src)); goto CONV_END;
279 conv_1234_xx34: as_u16(dst) = as_u32c(src) & 0xffff; goto CONV_END;
280 conv_1234_x432: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
281 conv_1234_234x: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
282 conv_1234_xxxC: as_u8(dst) = (as_u32c(src) & 0xff) ^ 0x80; goto CONV_END;
283 conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32c(src) ^ 0x80); goto CONV_END;
284 conv_1234_xx3C: as_u16(dst) = (as_u32c(src) & 0xffff) ^ 0x80; goto CONV_END;
285 conv_1234_xC32: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x800000; goto CONV_END;
286 conv_1234_23Cx: as_u32(dst) = (as_u32c(src) ^ 0x80) << 8; goto CONV_END;
287 conv_1234_C321: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x80); goto CONV_END;
288 conv_1234_123C: as_u32(dst) = as_u32c(src) ^ 0x80; goto CONV_END;
289 }
290 #endif
291
292 #ifdef GET16_LABELS
293 /* src_wid src_endswap sign_toggle */
294 static void *get16_labels[4 * 2 * 2] = {
295         &&get16_1_10,    /*  8h -> 16h */
296         &&get16_1_90,    /*  8h ^> 16h */
297         &&get16_1_10,    /*  8s -> 16h */
298         &&get16_1_90,    /*  8s ^> 16h */
299         &&get16_12_12,   /* 16h -> 16h */
300         &&get16_12_92,   /* 16h ^> 16h */
301         &&get16_12_21,   /* 16s -> 16h */
302         &&get16_12_A1,   /* 16s ^> 16h */
303         &&get16_0123_12, /* 24h -> 16h */
304         &&get16_0123_92, /* 24h ^> 16h */
305         &&get16_1230_32, /* 24s -> 16h */
306         &&get16_1230_B2, /* 24s ^> 16h */
307         &&get16_1234_12, /* 32h -> 16h */
308         &&get16_1234_92, /* 32h ^> 16h */
309         &&get16_1234_43, /* 32s -> 16h */
310         &&get16_1234_C3, /* 32s ^> 16h */
311 };
312 #endif
313
314 #ifdef GET16_END
315 while(0) {
316 get16_1_10: sample = (u_int16_t)as_u8c(src) << 8; goto GET16_END;
317 get16_1_90: sample = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END;
318 get16_12_12: sample = as_u16c(src); goto GET16_END;
319 get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END;
320 get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END;
321 get16_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GET16_END;
322 get16_0123_12: sample = as_u32c(src) >> 8; goto GET16_END;
323 get16_0123_92: sample = (as_u32c(src) >> 8) ^ 0x8000; goto GET16_END;
324 get16_1230_32: sample = bswap_16(as_u32c(src) >> 8); goto GET16_END;
325 get16_1230_B2: sample = bswap_16((as_u32c(src) >> 8) ^ 0x8000); goto GET16_END;
326 get16_1234_12: sample = as_u32c(src) >> 16; goto GET16_END;
327 get16_1234_92: sample = (as_u32c(src) >> 16) ^ 0x8000; goto GET16_END;
328 get16_1234_43: sample = bswap_16(as_u32c(src)); goto GET16_END;
329 get16_1234_C3: sample = bswap_16(as_u32c(src) ^ 0x80); goto GET16_END;
330 }
331 #endif
332
333 #ifdef PUT16_LABELS
334 /* dst_wid dst_endswap sign_toggle */
335 static void *put16_labels[4 * 2 * 2 * 4 * 2] = {
336         &&put16_12_1,    /* 16h ->  8h */
337         &&put16_12_9,    /* 16h ^>  8h */
338         &&put16_12_1,    /* 16h ->  8s */
339         &&put16_12_9,    /* 16h ^>  8s */
340         &&put16_12_12,   /* 16h -> 16h */
341         &&put16_12_92,   /* 16h ^> 16h */
342         &&put16_12_21,   /* 16h -> 16s */
343         &&put16_12_29,   /* 16h ^> 16s */
344         &&put16_12_0120,         /* 16h -> 24h */
345         &&put16_12_0920,         /* 16h ^> 24h */
346         &&put16_12_0210,         /* 16h -> 24s */
347         &&put16_12_0290,         /* 16h ^> 24s */
348         &&put16_12_1200,         /* 16h -> 32h */
349         &&put16_12_9200,         /* 16h ^> 32h */
350         &&put16_12_0021,         /* 16h -> 32s */
351         &&put16_12_0029,         /* 16h ^> 32s */
352 };
353 #endif
354
355 #ifdef PUT16_END
356 while (0) {
357 put16_12_1: as_u8(dst) = sample >> 8; goto PUT16_END;
358 put16_12_9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT16_END;
359 put16_12_12: as_u16(dst) = sample; goto PUT16_END;
360 put16_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT16_END;
361 put16_12_21: as_u16(dst) = bswap_16(sample); goto PUT16_END;
362 put16_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT16_END;
363 put16_12_0120: as_u32(dst) = (u_int32_t)sample << 8; goto PUT16_END;
364 put16_12_0920: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 8; goto PUT16_END;
365 put16_12_0210: as_u32(dst) = (u_int32_t)bswap_16(sample) << 8; goto PUT16_END;
366 put16_12_0290: as_u32(dst) = (u_int32_t)(bswap_16(sample) ^ 0x80) << 8; goto PUT16_END;
367 put16_12_1200: as_u32(dst) = (u_int32_t)sample << 16; goto PUT16_END;
368 put16_12_9200: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 16; goto PUT16_END;
369 put16_12_0021: as_u32(dst) = (u_int32_t)bswap_16(sample); goto PUT16_END;
370 put16_12_0029: as_u32(dst) = (u_int32_t)bswap_16(sample) ^ 0x80; goto PUT16_END;
371 }
372 #endif
373
374 #ifdef GET32_LABELS
375 /* src_wid src_endswap sign_toggle */
376 static void *get32_labels[4 * 2 * 2] = {
377         &&get32_1_1000,         /*  8h -> 32h */
378         &&get32_1_9000,         /*  8h ^> 32h */
379         &&get32_1_1000,         /*  8s -> 32h */
380         &&get32_1_9000,          /*  8s ^> 32h */
381         &&get32_12_1200,         /* 16h -> 32h */
382         &&get32_12_9200,         /* 16h ^> 32h */
383         &&get32_12_2100,         /* 16s -> 32h */
384         &&get32_12_A100,         /* 16s ^> 32h */
385         &&get32_0123_1230,       /* 24h -> 32h */
386         &&get32_0123_9230,       /* 24h ^> 32h */
387         &&get32_1230_3210,       /* 24s -> 32h */
388         &&get32_1230_B210,       /* 24s ^> 32h */
389         &&get32_1234_1234,       /* 32h -> 32h */
390         &&get32_1234_9234,       /* 32h ^> 32h */
391         &&get32_1234_4321,       /* 32s -> 32h */
392         &&get32_1234_C321,       /* 32s ^> 32h */
393 };
394 #endif
395
396 #ifdef GET32_END
397 while (0) {
398 get32_1_1000: sample = (u_int32_t)as_u8c(src) << 24; goto GET32_END;
399 get32_1_9000: sample = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END;
400 get32_12_1200: sample = (u_int32_t)as_u16c(src) << 16; goto GET32_END;
401 get32_12_9200: sample = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END;
402 get32_12_2100: sample = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END;
403 get32_12_A100: sample = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END;
404 get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END;
405 get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END;
406 get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END;
407 get32_1230_B210: sample = bswap_32((as_u32c(src) >> 8) ^ 0x80); goto GET32_END;
408 get32_1234_1234: sample = as_u32c(src); goto GET32_END;
409 get32_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GET32_END;
410 get32_1234_4321: sample = bswap_32(as_u32c(src)); goto GET32_END;
411 get32_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GET32_END;
412 }
413 #endif
414
415 #ifdef PUT32_LABELS
416 /* dst_wid dst_endswap sign_toggle */
417 static void *put32_labels[4 * 2 * 2] = {
418         &&put32_1234_1,         /* 32h ->  8h */
419         &&put32_1234_9,         /* 32h ^>  8h */
420         &&put32_1234_1,         /* 32h ->  8s */
421         &&put32_1234_9,         /* 32h ^>  8s */
422         &&put32_1234_12,         /* 32h -> 16h */
423         &&put32_1234_92,         /* 32h ^> 16h */
424         &&put32_1234_21,         /* 32h -> 16s */
425         &&put32_1234_29,         /* 32h ^> 16s */
426         &&put32_1234_0123,       /* 32h -> 24h */
427         &&put32_1234_0923,       /* 32h ^> 24h */
428         &&put32_1234_3210,       /* 32h -> 24s */
429         &&put32_1234_3290,       /* 32h ^> 24s */
430         &&put32_1234_1234,       /* 32h -> 32h */
431         &&put32_1234_9234,       /* 32h ^> 32h */
432         &&put32_1234_4321,       /* 32h -> 32s */
433         &&put32_1234_4329,       /* 32h ^> 32s */
434 };
435 #endif
436
437 #ifdef PUT32_END
438 while (0) {
439 put32_1234_1: as_u8(dst) = sample >> 24; goto PUT32_END;
440 put32_1234_9: as_u8(dst) = (sample >> 24) ^ 0x80; goto PUT32_END;
441 put32_1234_12: as_u16(dst) = sample >> 16; goto PUT32_END;
442 put32_1234_92: as_u16(dst) = (sample >> 16) ^ 0x8000; goto PUT32_END;
443 put32_1234_21: as_u16(dst) = bswap_16(sample >> 16); goto PUT32_END;
444 put32_1234_29: as_u16(dst) = bswap_16(sample >> 16) ^ 0x80; goto PUT32_END;
445 put32_1234_0123: as_u32(dst) = sample >> 8; goto PUT32_END;
446 put32_1234_0923: as_u32(dst) = (sample >> 8) ^ 0x800000; goto PUT32_END;
447 put32_1234_3210: as_u32(dst) = bswap_32(sample) << 8; goto PUT32_END;
448 put32_1234_3290: as_u32(dst) = (bswap_32(sample) ^ 0x80) << 8; goto PUT32_END;
449 put32_1234_1234: as_u32(dst) = sample; goto PUT32_END;
450 put32_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT32_END;
451 put32_1234_4321: as_u32(dst) = bswap_32(sample); goto PUT32_END;
452 put32_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT32_END;
453 }
454 #endif
455
456 #ifdef GETU_LABELS
457 /* width endswap sign_toggle */
458 static void *getu_labels[4 * 2 * 2] = {
459         &&getu_1_1,             /*  8h ->  8h */
460         &&getu_1_9,             /*  8h ^>  8h */
461         &&getu_1_1,             /*  8s ->  8h */
462         &&getu_1_9,             /*  8s ^>  8h */
463         &&getu_12_12,           /* 16h -> 16h */
464         &&getu_12_92,           /* 16h ^> 16h */
465         &&getu_12_21,           /* 16s -> 16h */
466         &&getu_12_A1,           /* 16s ^> 16h */
467         &&getu_0123_0123,       /* 24h -> 24h */
468         &&getu_0123_0923,       /* 24h ^> 24h */
469         &&getu_1230_0321,       /* 24s -> 24h */
470         &&getu_1230_0B21,       /* 24s ^> 24h */
471         &&getu_1234_1234,       /* 32h -> 32h */
472         &&getu_1234_9234,       /* 32h ^> 32h */
473         &&getu_1234_4321,       /* 32s -> 32h */
474         &&getu_1234_C321,       /* 32s ^> 32h */
475 };
476 #endif
477
478 #ifdef GETU_END
479 while (0) {
480 getu_1_1: sample = as_u8c(src); goto GETU_END;
481 getu_1_9: sample = as_u8c(src) ^ 0x80; goto GETU_END;
482 getu_12_12: sample = as_u16c(src); goto GETU_END;
483 getu_12_92: sample = as_u16c(src) ^ 0x8000; goto GETU_END;
484 getu_12_21: sample = bswap_16(as_u16c(src)); goto GETU_END;
485 getu_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GETU_END;
486 getu_0123_0123: sample = as_u32c(src); goto GETU_END;
487 getu_0123_0923: sample = (as_u32c(src) ^ 0x800000); goto GETU_END;
488 getu_1230_0321: sample = bswap_32(as_u32c(src)); goto GETU_END;
489 getu_1230_0B21: sample = bswap_32(as_u32c(src) ^ 0x8000); goto GETU_END;
490 getu_1234_1234: sample = as_u32c(src); goto GETU_END;
491 getu_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GETU_END;
492 getu_1234_4321: sample = bswap_32(as_u32c(src)); goto GETU_END;
493 getu_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GETU_END;
494 }
495 #endif
496
497 #ifdef GETS_LABELS
498 /* width endswap sign_toggle */
499 static void *gets_labels[4 * 2 * 2] = {
500         &&gets_1_1,             /*  8h ->  8h */
501         &&gets_1_9,             /*  8h ^>  8h */
502         &&gets_1_1,             /*  8s ->  8h */
503         &&gets_1_9,             /*  8s ^>  8h */
504         &&gets_12_12,           /* 16h -> 16h */
505         &&gets_12_92,           /* 16h ^> 16h */
506         &&gets_12_21,           /* 16s -> 16h */
507         &&gets_12_A1,           /* 16s ^> 16h */
508         &&gets_0123_0123,       /* 24h -> 24h */
509         &&gets_0123_0923,       /* 24h ^> 24h */
510         &&gets_1230_0321,       /* 24s -> 24h */
511         &&gets_1230_0B21,       /* 24s ^> 24h */
512         &&gets_1234_1234,       /* 32h -> 32h */
513         &&gets_1234_9234,       /* 32h ^> 32h */
514         &&gets_1234_4321,       /* 32s -> 32h */
515         &&gets_1234_C321,       /* 32s ^> 32h */
516 };
517 #endif
518
519 #ifdef GETS_END
520 while (0) {
521 gets_1_1: sample = as_s8c(src); goto GETS_END;
522 gets_1_9: sample = as_s8c(src) ^ 0x80; goto GETS_END;
523 gets_12_12: sample = as_s16c(src); goto GETS_END;
524 gets_12_92: sample = as_s16c(src) ^ 0x8000; goto GETS_END;
525 gets_12_21: sample = bswap_16(as_s16c(src)); goto GETS_END;
526 gets_12_A1: sample = (int16_t)bswap_16(as_s16c(src) ^ 0x80); goto GETS_END;
527 gets_0123_0123: sample = as_s32c(src); goto GETS_END;
528 gets_0123_0923: sample = (as_s32c(src) ^ 0x800000); goto GETS_END;
529 gets_1230_0321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END;
530 gets_1230_0B21: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x8000); goto GETS_END;
531 gets_1234_1234: sample = as_s32c(src); goto GETS_END;
532 gets_1234_9234: sample = as_s32c(src) ^ 0x80000000; goto GETS_END;
533 gets_1234_4321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END;
534 gets_1234_C321: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x80); goto GETS_END;
535 }
536 #endif
537
538 #ifdef PUT_LABELS
539 /* width endswap sign_toggle */
540 static void *put_labels[4 * 2 * 2] = {
541         &&put_1_1,              /*  8h ->  8h */
542         &&put_1_9,              /*  8h ^>  8h */
543         &&put_1_1,              /*  8h ->  8s */
544         &&put_1_9,              /*  8h ^>  8s */
545         &&put_12_12,            /* 16h -> 16h */
546         &&put_12_92,            /* 16h ^> 16h */
547         &&put_12_21,            /* 16h -> 16s */
548         &&put_12_A1,            /* 16h ^> 16s */
549         &&put_0123_0123,        /* 24h -> 24h */
550         &&put_0123_0923,        /* 24h ^> 24h */
551         &&put_0123_3210,        /* 24h -> 24s */
552         &&put_0123_3290,        /* 24h ^> 24s */
553         &&put_1234_1234,        /* 32h -> 32h */
554         &&put_1234_9234,        /* 32h ^> 32h */
555         &&put_1234_4321,        /* 32h -> 32s */
556         &&put_1234_4329,        /* 32h ^> 32s */
557 };
558 #endif
559
560 #ifdef PUT_END
561 put_1_1: as_s8(dst) = sample; goto PUT_END;
562 put_1_9: as_u8(dst) = sample ^ 0x80; goto PUT_END;
563 put_12_12: as_s16(dst) = sample; goto PUT_END;
564 put_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT_END;
565 put_12_21: as_s16(dst) = bswap_16(sample); goto PUT_END;
566 put_12_A1: as_u16(dst) = bswap_16(sample ^ 0x80); goto PUT_END;
567 put_0123_0123: as_s24(dst) = sample; goto PUT_END;
568 put_0123_0923: as_u24(dst) = sample ^ 0x800000; goto PUT_END;
569 put_0123_3210: as_s24(dst) = bswap_32(sample); goto PUT_END;
570 put_0123_3290: as_u24(dst) = bswap_32(sample) ^ 0x8000; goto PUT_END;
571 put_1234_1234: as_s32(dst) = sample; goto PUT_END;
572 put_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT_END;
573 put_1234_4321: as_s32(dst) = bswap_32(sample); goto PUT_END;
574 put_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT_END;
575 #endif
576
577
578 #undef as_u8
579 #undef as_u16
580 #undef as_u32
581 #undef as_s8
582 #undef as_s16
583 #undef as_s32