1 /*
2 * Plugin sample operators with fast switch
3 * Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
4 *
5 *
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #ifndef SX_INLINES
23 #define SX_INLINES
sx20(uint32_t x)24 static inline uint32_t sx20(uint32_t x)
25 {
26 if(x&0x00080000)
27 return x|0xFFF00000;
28 return x&0x000FFFFF;
29 }
sx24(uint32_t x)30 static inline uint32_t sx24(uint32_t x)
31 {
32 if(x&0x00800000)
33 return x|0xFF000000;
34 return x&0x00FFFFFF;
35 }
sx24s(uint32_t x)36 static inline uint32_t sx24s(uint32_t x)
37 {
38 if(x&0x00008000)
39 return x|0x000000FF;
40 return x&0xFFFFFF00;
41 }
42 #endif
43
44 #define as_u8(ptr) (*(uint8_t*)(ptr))
45 #define as_u16(ptr) (*(uint16_t*)(ptr))
46 #define as_u32(ptr) (*(uint32_t*)(ptr))
47 #define as_u64(ptr) (*(uint64_t*)(ptr))
48 #define as_s8(ptr) (*(int8_t*)(ptr))
49 #define as_s16(ptr) (*(int16_t*)(ptr))
50 #define as_s32(ptr) (*(int32_t*)(ptr))
51 #define as_s64(ptr) (*(int64_t*)(ptr))
52 #define as_float(ptr) (*(float_t*)(ptr))
53 #define as_double(ptr) (*(double_t*)(ptr))
54
55 #define as_u8c(ptr) (*(const uint8_t*)(ptr))
56 #define as_u16c(ptr) (*(const uint16_t*)(ptr))
57 #define as_u32c(ptr) (*(const uint32_t*)(ptr))
58 #define as_u64c(ptr) (*(const uint64_t*)(ptr))
59 #define as_s8c(ptr) (*(const int8_t*)(ptr))
60 #define as_s16c(ptr) (*(const int16_t*)(ptr))
61 #define as_s32c(ptr) (*(const int32_t*)(ptr))
62 #define as_s64c(ptr) (*(const int64_t*)(ptr))
63 #define as_floatc(ptr) (*(const float_t*)(ptr))
64 #define as_doublec(ptr) (*(const double_t*)(ptr))
65
66 #define _get_triple_le(ptr) (*(uint8_t*)(ptr) | (uint32_t)*((uint8_t*)(ptr) + 1) << 8 | (uint32_t)*((uint8_t*)(ptr) + 2) << 16)
67 #define _get_triple_be(ptr) ((uint32_t)*(uint8_t*)(ptr) << 16 | (uint32_t)*((uint8_t*)(ptr) + 1) << 8 | *((uint8_t*)(ptr) + 2))
68 #define _put_triple_le(ptr,val) do { \
69 uint8_t *_tmp = (uint8_t *)(ptr); \
70 uint32_t _val = (val); \
71 _tmp[0] = _val; \
72 _tmp[1] = _val >> 8; \
73 _tmp[2] = _val >> 16; \
74 } while(0)
75 #define _put_triple_be(ptr,val) do { \
76 uint8_t *_tmp = (uint8_t *)(ptr); \
77 uint32_t _val = (val); \
78 _tmp[0] = _val >> 16; \
79 _tmp[1] = _val >> 8; \
80 _tmp[2] = _val; \
81 } while(0)
82
83 #ifdef SNDRV_LITTLE_ENDIAN
84 #define _get_triple(ptr) _get_triple_le(ptr)
85 #define _get_triple_s(ptr) _get_triple_be(ptr)
86 #define _put_triple(ptr,val) _put_triple_le(ptr,val)
87 #define _put_triple_s(ptr,val) _put_triple_be(ptr,val)
88 #else
89 #define _get_triple(ptr) _get_triple_be(ptr)
90 #define _get_triple_s(ptr) _get_triple_le(ptr)
91 #define _put_triple(ptr,val) _put_triple_be(ptr,val)
92 #define _put_triple_s(ptr,val) _put_triple_le(ptr,val)
93 #endif
94
95 #ifdef CONV_LABELS
96 /* src_wid src_endswap sign_toggle dst_wid dst_endswap */
97 static void *const conv_labels[4 * 2 * 2 * 4 * 2] = {
98 &&conv_xxx1_xxx1, /* 8h -> 8h */
99 &&conv_xxx1_xxx1, /* 8h -> 8s */
100 &&conv_xxx1_xx10, /* 8h -> 16h */
101 &&conv_xxx1_xx01, /* 8h -> 16s */
102 &&conv_xxx1_x100, /* 8h -> 24h */
103 &&conv_xxx1_001x, /* 8h -> 24s */
104 &&conv_xxx1_1000, /* 8h -> 32h */
105 &&conv_xxx1_0001, /* 8h -> 32s */
106 &&conv_xxx1_xxx9, /* 8h ^> 8h */
107 &&conv_xxx1_xxx9, /* 8h ^> 8s */
108 &&conv_xxx1_xx90, /* 8h ^> 16h */
109 &&conv_xxx1_xx09, /* 8h ^> 16s */
110 &&conv_xxx1_x900, /* 8h ^> 24h */
111 &&conv_xxx1_009x, /* 8h ^> 24s */
112 &&conv_xxx1_9000, /* 8h ^> 32h */
113 &&conv_xxx1_0009, /* 8h ^> 32s */
114 &&conv_xxx1_xxx1, /* 8s -> 8h */
115 &&conv_xxx1_xxx1, /* 8s -> 8s */
116 &&conv_xxx1_xx10, /* 8s -> 16h */
117 &&conv_xxx1_xx01, /* 8s -> 16s */
118 &&conv_xxx1_x100, /* 8s -> 24h */
119 &&conv_xxx1_001x, /* 8s -> 24s */
120 &&conv_xxx1_1000, /* 8s -> 32h */
121 &&conv_xxx1_0001, /* 8s -> 32s */
122 &&conv_xxx1_xxx9, /* 8s ^> 8h */
123 &&conv_xxx1_xxx9, /* 8s ^> 8s */
124 &&conv_xxx1_xx90, /* 8s ^> 16h */
125 &&conv_xxx1_xx09, /* 8s ^> 16s */
126 &&conv_xxx1_x900, /* 8s ^> 24h */
127 &&conv_xxx1_009x, /* 8s ^> 24s */
128 &&conv_xxx1_9000, /* 8s ^> 32h */
129 &&conv_xxx1_0009, /* 8s ^> 32s */
130 &&conv_xx12_xxx1, /* 16h -> 8h */
131 &&conv_xx12_xxx1, /* 16h -> 8s */
132 &&conv_xx12_xx12, /* 16h -> 16h */
133 &&conv_xx12_xx21, /* 16h -> 16s */
134 &&conv_xx12_x120, /* 16h -> 24h */
135 &&conv_xx12_021x, /* 16h -> 24s */
136 &&conv_xx12_1200, /* 16h -> 32h */
137 &&conv_xx12_0021, /* 16h -> 32s */
138 &&conv_xx12_xxx9, /* 16h ^> 8h */
139 &&conv_xx12_xxx9, /* 16h ^> 8s */
140 &&conv_xx12_xx92, /* 16h ^> 16h */
141 &&conv_xx12_xx29, /* 16h ^> 16s */
142 &&conv_xx12_x920, /* 16h ^> 24h */
143 &&conv_xx12_029x, /* 16h ^> 24s */
144 &&conv_xx12_9200, /* 16h ^> 32h */
145 &&conv_xx12_0029, /* 16h ^> 32s */
146 &&conv_xx12_xxx2, /* 16s -> 8h */
147 &&conv_xx12_xxx2, /* 16s -> 8s */
148 &&conv_xx12_xx21, /* 16s -> 16h */
149 &&conv_xx12_xx12, /* 16s -> 16s */
150 &&conv_xx12_x210, /* 16s -> 24h */
151 &&conv_xx12_012x, /* 16s -> 24s */
152 &&conv_xx12_2100, /* 16s -> 32h */
153 &&conv_xx12_0012, /* 16s -> 32s */
154 &&conv_xx12_xxxA, /* 16s ^> 8h */
155 &&conv_xx12_xxxA, /* 16s ^> 8s */
156 &&conv_xx12_xxA1, /* 16s ^> 16h */
157 &&conv_xx12_xx1A, /* 16s ^> 16s */
158 &&conv_xx12_xA10, /* 16s ^> 24h */
159 &&conv_xx12_01Ax, /* 16s ^> 24s */
160 &&conv_xx12_A100, /* 16s ^> 32h */
161 &&conv_xx12_001A, /* 16s ^> 32s */
162 &&conv_x123_xxx1, /* 24h -> 8h */
163 &&conv_x123_xxx1, /* 24h -> 8s */
164 &&conv_x123_xx12, /* 24h -> 16h */
165 &&conv_x123_xx21, /* 24h -> 16s */
166 &&conv_x123_x123, /* 24h -> 24h */
167 &&conv_x123_321x, /* 24h -> 24s */
168 &&conv_x123_1230, /* 24h -> 32h */
169 &&conv_x123_0321, /* 24h -> 32s */
170 &&conv_x123_xxx9, /* 24h ^> 8h */
171 &&conv_x123_xxx9, /* 24h ^> 8s */
172 &&conv_x123_xx92, /* 24h ^> 16h */
173 &&conv_x123_xx29, /* 24h ^> 16s */
174 &&conv_x123_x923, /* 24h ^> 24h */
175 &&conv_x123_329x, /* 24h ^> 24s */
176 &&conv_x123_9230, /* 24h ^> 32h */
177 &&conv_x123_0329, /* 24h ^> 32s */
178 &&conv_123x_xxx3, /* 24s -> 8h */
179 &&conv_123x_xxx3, /* 24s -> 8s */
180 &&conv_123x_xx32, /* 24s -> 16h */
181 &&conv_123x_xx23, /* 24s -> 16s */
182 &&conv_123x_x321, /* 24s -> 24h */
183 &&conv_123x_123x, /* 24s -> 24s */
184 &&conv_123x_3210, /* 24s -> 32h */
185 &&conv_123x_0123, /* 24s -> 32s */
186 &&conv_123x_xxxB, /* 24s ^> 8h */
187 &&conv_123x_xxxB, /* 24s ^> 8s */
188 &&conv_123x_xxB2, /* 24s ^> 16h */
189 &&conv_123x_xx2B, /* 24s ^> 16s */
190 &&conv_123x_xB21, /* 24s ^> 24h */
191 &&conv_123x_12Bx, /* 24s ^> 24s */
192 &&conv_123x_B210, /* 24s ^> 32h */
193 &&conv_123x_012B, /* 24s ^> 32s */
194 &&conv_1234_xxx1, /* 32h -> 8h */
195 &&conv_1234_xxx1, /* 32h -> 8s */
196 &&conv_1234_xx12, /* 32h -> 16h */
197 &&conv_1234_xx21, /* 32h -> 16s */
198 &&conv_1234_x123, /* 32h -> 24h */
199 &&conv_1234_321x, /* 32h -> 24s */
200 &&conv_1234_1234, /* 32h -> 32h */
201 &&conv_1234_4321, /* 32h -> 32s */
202 &&conv_1234_xxx9, /* 32h ^> 8h */
203 &&conv_1234_xxx9, /* 32h ^> 8s */
204 &&conv_1234_xx92, /* 32h ^> 16h */
205 &&conv_1234_xx29, /* 32h ^> 16s */
206 &&conv_1234_x923, /* 32h ^> 24h */
207 &&conv_1234_329x, /* 32h ^> 24s */
208 &&conv_1234_9234, /* 32h ^> 32h */
209 &&conv_1234_4329, /* 32h ^> 32s */
210 &&conv_1234_xxx4, /* 32s -> 8h */
211 &&conv_1234_xxx4, /* 32s -> 8s */
212 &&conv_1234_xx43, /* 32s -> 16h */
213 &&conv_1234_xx34, /* 32s -> 16s */
214 &&conv_1234_x432, /* 32s -> 24h */
215 &&conv_1234_234x, /* 32s -> 24s */
216 &&conv_1234_4321, /* 32s -> 32h */
217 &&conv_1234_1234, /* 32s -> 32s */
218 &&conv_1234_xxxC, /* 32s ^> 8h */
219 &&conv_1234_xxxC, /* 32s ^> 8s */
220 &&conv_1234_xxC3, /* 32s ^> 16h */
221 &&conv_1234_xx3C, /* 32s ^> 16s */
222 &&conv_1234_xC32, /* 32s ^> 24h */
223 &&conv_1234_23Cx, /* 32s ^> 24s */
224 &&conv_1234_C321, /* 32s ^> 32h */
225 &&conv_1234_123C, /* 32s ^> 32s */
226 };
227 #endif
228
229 #ifdef CONV_END
230 while(0) {
231 conv_xxx1_xxx1: as_u8(dst) = as_u8c(src); goto CONV_END;
232 conv_xxx1_xx10: as_u16(dst) = (uint16_t)as_u8c(src) << 8; goto CONV_END;
233 conv_xxx1_xx01: as_u16(dst) = (uint16_t)as_u8c(src); goto CONV_END;
234 conv_xxx1_x100: as_u32(dst) = sx24((uint32_t)as_u8c(src) << 16); goto CONV_END;
235 conv_xxx1_001x: as_u32(dst) = sx24s((uint32_t)as_u8c(src) << 8); goto CONV_END;
236 conv_xxx1_1000: as_u32(dst) = (uint32_t)as_u8c(src) << 24; goto CONV_END;
237 conv_xxx1_0001: as_u32(dst) = (uint32_t)as_u8c(src); goto CONV_END;
238 conv_xxx1_xxx9: as_u8(dst) = as_u8c(src) ^ 0x80; goto CONV_END;
239 conv_xxx1_xx90: as_u16(dst) = (uint16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
240 conv_xxx1_xx09: as_u16(dst) = (uint16_t)(as_u8c(src) ^ 0x80); goto CONV_END;
241 conv_xxx1_x900: as_u32(dst) = sx24((uint32_t)(as_u8c(src) ^ 0x80) << 16); goto CONV_END;
242 conv_xxx1_009x: as_u32(dst) = sx24s((uint32_t)(as_u8c(src) ^ 0x80) << 8); goto CONV_END;
243 conv_xxx1_9000: as_u32(dst) = (uint32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END;
244 conv_xxx1_0009: as_u32(dst) = (uint32_t)(as_u8c(src) ^ 0x80); goto CONV_END;
245 conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END;
246 conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END;
247 conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END;
248 conv_xx12_x120: as_u32(dst) = sx24((uint32_t)as_u16c(src) << 8); goto CONV_END;
249 conv_xx12_021x: as_u32(dst) = sx24s((uint32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
250 conv_xx12_1200: as_u32(dst) = (uint32_t)as_u16c(src) << 16; goto CONV_END;
251 conv_xx12_0021: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src)); goto CONV_END;
252 conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END;
253 conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END;
254 conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END;
255 conv_xx12_x920: as_u32(dst) = sx24((uint32_t)(as_u16c(src) ^ 0x8000) << 8); goto CONV_END;
256 conv_xx12_029x: as_u32(dst) = sx24s((uint32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8); goto CONV_END;
257 conv_xx12_9200: as_u32(dst) = (uint32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END;
258 conv_xx12_0029: as_u32(dst) = (uint32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END;
259 conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END;
260 conv_xx12_x210: as_u32(dst) = sx24((uint32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
261 conv_xx12_012x: as_u32(dst) = sx24s((uint32_t)as_u16c(src) << 8); goto CONV_END;
262 conv_xx12_2100: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END;
263 conv_xx12_0012: as_u32(dst) = (uint32_t)as_u16c(src); goto CONV_END;
264 conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END;
265 conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END;
266 conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END;
267 conv_xx12_xA10: as_u32(dst) = sx24((uint32_t)bswap_16(as_u16c(src) ^ 0x80) << 8); goto CONV_END;
268 conv_xx12_01Ax: as_u32(dst) = sx24s((uint32_t)(as_u16c(src) ^ 0x80) << 8); goto CONV_END;
269 conv_xx12_A100: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END;
270 conv_xx12_001A: as_u32(dst) = (uint32_t)(as_u16c(src) ^ 0x80); goto CONV_END;
271 conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END;
272 conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END;
273 conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
274 conv_x123_x123: as_u32(dst) = sx24(as_u32c(src)); goto CONV_END;
275 conv_x123_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src))); goto CONV_END;
276 conv_x123_1230: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
277 conv_x123_0321: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
278 conv_x123_xxx9: as_u8(dst) = (as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
279 conv_x123_xx92: as_u16(dst) = (as_u32c(src) >> 8) ^ 0x8000; goto CONV_END;
280 conv_x123_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
281 conv_x123_x923: as_u32(dst) = sx24(as_u32c(src) ^ 0x800000); goto CONV_END;
282 conv_x123_329x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) ^ 0x8000); goto CONV_END;
283 conv_x123_9230: as_u32(dst) = (as_u32c(src) ^ 0x800000) << 8; goto CONV_END;
284 conv_x123_0329: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x80; goto CONV_END;
285 conv_123x_xxx3: as_u8(dst) = (as_u32c(src) >> 8) & 0xff; goto CONV_END;
286 conv_123x_xx32: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
287 conv_123x_xx23: as_u16(dst) = (as_u32c(src) >> 8) & 0xffff; goto CONV_END;
288 conv_123x_x321: as_u32(dst) = sx24(bswap_32(as_u32c(src))); goto CONV_END;
289 conv_123x_123x: as_u32(dst) = sx24s(as_u32c(src)); goto CONV_END;
290 conv_123x_3210: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
291 conv_123x_0123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
292 conv_123x_xxxB: as_u8(dst) = ((as_u32c(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
293 conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto CONV_END;
294 conv_123x_xx2B: as_u16(dst) = ((as_u32c(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
295 conv_123x_xB21: as_u32(dst) = sx24(bswap_32(as_u32c(src)) ^ 0x800000); goto CONV_END;
296 conv_123x_12Bx: as_u32(dst) = sx24s(as_u32c(src) ^ 0x8000); goto CONV_END;
297 conv_123x_B210: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x8000) << 8; goto CONV_END;
298 conv_123x_012B: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
299 conv_1234_xxx1: as_u8(dst) = as_u32c(src) >> 24; goto CONV_END;
300 conv_1234_xx12: as_u16(dst) = as_u32c(src) >> 16; goto CONV_END;
301 conv_1234_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 16); goto CONV_END;
302 conv_1234_x123: as_u32(dst) = sx24(as_u32c(src) >> 8); goto CONV_END;
303 conv_1234_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) << 8); goto CONV_END;
304 conv_1234_1234: as_u32(dst) = as_u32c(src); goto CONV_END;
305 conv_1234_4321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
306 conv_1234_xxx9: as_u8(dst) = (as_u32c(src) >> 24) ^ 0x80; goto CONV_END;
307 conv_1234_xx92: as_u16(dst) = (as_u32c(src) >> 16) ^ 0x8000; goto CONV_END;
308 conv_1234_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
309 conv_1234_x923: as_u32(dst) = sx24((as_u32c(src) >> 8) ^ 0x800000); goto CONV_END;
310 conv_1234_329x: as_u32(dst) = sx24s((bswap_32(as_u32c(src)) ^ 0x80) << 8); goto CONV_END;
311 conv_1234_9234: as_u32(dst) = as_u32c(src) ^ 0x80000000; goto CONV_END;
312 conv_1234_4329: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x80; goto CONV_END;
313 conv_1234_xxx4: as_u8(dst) = as_u32c(src) & 0xff; goto CONV_END;
314 conv_1234_xx43: as_u16(dst) = bswap_16(as_u32c(src)); goto CONV_END;
315 conv_1234_xx34: as_u16(dst) = as_u32c(src) & 0xffff; goto CONV_END;
316 conv_1234_x432: as_u32(dst) = sx24(bswap_32(as_u32c(src)) >> 8); goto CONV_END;
317 conv_1234_234x: as_u32(dst) = sx24s(as_u32c(src) << 8); goto CONV_END;
318 conv_1234_xxxC: as_u8(dst) = (as_u32c(src) & 0xff) ^ 0x80; goto CONV_END;
319 conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32c(src) ^ 0x80); goto CONV_END;
320 conv_1234_xx3C: as_u16(dst) = (as_u32c(src) & 0xffff) ^ 0x80; goto CONV_END;
321 conv_1234_xC32: as_u32(dst) = sx24((bswap_32(as_u32c(src)) >> 8) ^ 0x800000); goto CONV_END;
322 conv_1234_23Cx: as_u32(dst) = sx24s((as_u32c(src) ^ 0x80) << 8); goto CONV_END;
323 conv_1234_C321: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x80); goto CONV_END;
324 conv_1234_123C: as_u32(dst) = as_u32c(src) ^ 0x80; goto CONV_END;
325 }
326 #endif
327
328 #ifdef GET16_LABELS
329 /* src_wid src_endswap sign_toggle */
330 static void *const get16_labels[5 * 2 * 2 + 4 * 3] = {
331 &&get16_1_10, /* 8h -> 16h */
332 &&get16_1_90, /* 8h ^> 16h */
333 &&get16_1_10, /* 8s -> 16h */
334 &&get16_1_90, /* 8s ^> 16h */
335 &&get16_12_12, /* 16h -> 16h */
336 &&get16_12_92, /* 16h ^> 16h */
337 &&get16_12_21, /* 16s -> 16h */
338 &&get16_12_A1, /* 16s ^> 16h */
339 /* 4 byte formats */
340 &&get16_0123_12, /* 24h -> 16h */
341 &&get16_0123_92, /* 24h ^> 16h */
342 &&get16_1230_32, /* 24s -> 16h */
343 &&get16_1230_B2, /* 24s ^> 16h */
344 &&get16_1234_12, /* 32h -> 16h */
345 &&get16_1234_92, /* 32h ^> 16h */
346 &&get16_1234_43, /* 32s -> 16h */
347 &&get16_1234_C3, /* 32s ^> 16h */
348 &&get16_0123_12_20, /* 20h -> 16h */
349 &&get16_0123_92_20, /* 20h ^> 16h */
350 &&get16_1230_32_20, /* 20s -> 16h */
351 &&get16_1230_B2_20, /* 20s ^> 16h */
352 /* 3bytes format */
353 &&get16_123_12, /* 24h -> 16h */
354 &&get16_123_92, /* 24h ^> 16h */
355 &&get16_123_32, /* 24s -> 16h */
356 &&get16_123_B2, /* 24s ^> 16h */
357 &&get16_123_12_20, /* 20h -> 16h */
358 &&get16_123_92_20, /* 20h ^> 16h */
359 &&get16_123_32_20, /* 20s -> 16h */
360 &&get16_123_B2_20, /* 20s ^> 16h */
361 &&get16_123_12_18, /* 18h -> 16h */
362 &&get16_123_92_18, /* 18h ^> 16h */
363 &&get16_123_32_18, /* 18s -> 16h */
364 &&get16_123_B2_18, /* 18s ^> 16h */
365 };
366 #endif
367
368 #ifdef GET16_END
369 while(0) {
370 get16_1_10: sample = (uint16_t)as_u8c(src) << 8; goto GET16_END;
371 get16_1_90: sample = (uint16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END;
372 get16_12_12: sample = as_u16c(src); goto GET16_END;
373 get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END;
374 get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END;
375 get16_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GET16_END;
376 get16_0123_12: sample = as_u32c(src) >> 8; goto GET16_END;
377 get16_0123_92: sample = (as_u32c(src) >> 8) ^ 0x8000; goto GET16_END;
378 get16_1230_32: sample = bswap_16(as_u32c(src) >> 8); goto GET16_END;
379 get16_1230_B2: sample = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto GET16_END;
380 get16_1234_12: sample = as_u32c(src) >> 16; goto GET16_END;
381 get16_1234_92: sample = (as_u32c(src) >> 16) ^ 0x8000; goto GET16_END;
382 get16_1234_43: sample = bswap_16(as_u32c(src)); goto GET16_END;
383 get16_1234_C3: sample = bswap_16(as_u32c(src) ^ 0x80); goto GET16_END;
384 get16_0123_12_20: sample = as_u32c(src) >> 4; goto GET16_END;
385 get16_0123_92_20: sample = (as_u32c(src) >> 4) ^ 0x8000; goto GET16_END;
386 get16_1230_32_20: sample = bswap_32(as_u32c(src)) >> 4; goto GET16_END;
387 get16_1230_B2_20: sample = (bswap_32(as_u32c(src)) >> 4) ^ 0x8000; goto GET16_END;
388 get16_123_12: sample = _get_triple(src) >> 8; goto GET16_END;
389 get16_123_92: sample = (_get_triple(src) >> 8) ^ 0x8000; goto GET16_END;
390 get16_123_32: sample = _get_triple_s(src) >> 8; goto GET16_END;
391 get16_123_B2: sample = (_get_triple_s(src) >> 8) ^ 0x8000; goto GET16_END;
392 get16_123_12_20: sample = _get_triple(src) >> 4; goto GET16_END;
393 get16_123_92_20: sample = (_get_triple(src) >> 4) ^ 0x8000; goto GET16_END;
394 get16_123_32_20: sample = _get_triple_s(src) >> 4; goto GET16_END;
395 get16_123_B2_20: sample = (_get_triple_s(src) >> 4) ^ 0x8000; goto GET16_END;
396 get16_123_12_18: sample = _get_triple(src) >> 2; goto GET16_END;
397 get16_123_92_18: sample = (_get_triple(src) >> 2) ^ 0x8000; goto GET16_END;
398 get16_123_32_18: sample = _get_triple_s(src) >> 2; goto GET16_END;
399 get16_123_B2_18: sample = (_get_triple_s(src) >> 2) ^ 0x8000; goto GET16_END;
400 }
401 #endif
402
403 #ifdef PUT16_LABELS
404 /* dst_wid dst_endswap sign_toggle */
405 static void *const put16_labels[5 * 2 * 2 + 4 * 3] = {
406 &&put16_12_1, /* 16h -> 8h */
407 &&put16_12_9, /* 16h ^> 8h */
408 &&put16_12_1, /* 16h -> 8s */
409 &&put16_12_9, /* 16h ^> 8s */
410 &&put16_12_12, /* 16h -> 16h */
411 &&put16_12_92, /* 16h ^> 16h */
412 &&put16_12_21, /* 16h -> 16s */
413 &&put16_12_29, /* 16h ^> 16s */
414 /* 4 byte formats */
415 &&put16_12_0120, /* 16h -> 24h */
416 &&put16_12_0920, /* 16h ^> 24h */
417 &&put16_12_0210, /* 16h -> 24s */
418 &&put16_12_0290, /* 16h ^> 24s */
419 &&put16_12_1200, /* 16h -> 32h */
420 &&put16_12_9200, /* 16h ^> 32h */
421 &&put16_12_0021, /* 16h -> 32s */
422 &&put16_12_0029, /* 16h ^> 32s */
423 &&put16_12_0120_20, /* 16h -> 20h */
424 &&put16_12_0920_20, /* 16h ^> 20h */
425 &&put16_12_0210_20, /* 16h -> 20s */
426 &&put16_12_0290_20, /* 16h ^> 20s */
427 /* 3bytes format */
428 &&put16_12_120, /* 16h -> 24h */
429 &&put16_12_920, /* 16h ^> 24h */
430 &&put16_12_021, /* 16h -> 24s */
431 &&put16_12_029, /* 16h ^> 24s */
432 &&put16_12_120_20, /* 16h -> 20h */
433 &&put16_12_920_20, /* 16h ^> 20h */
434 &&put16_12_021_20, /* 16h -> 20s */
435 &&put16_12_029_20, /* 16h ^> 20s */
436 &&put16_12_120_18, /* 16h -> 18h */
437 &&put16_12_920_18, /* 16h ^> 18h */
438 &&put16_12_021_18, /* 16h -> 18s */
439 &&put16_12_029_18, /* 16h ^> 18s */
440 };
441 #endif
442
443 #ifdef PUT16_END
444 while (0) {
445 put16_12_1: as_u8(dst) = sample >> 8; goto PUT16_END;
446 put16_12_9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT16_END;
447 put16_12_12: as_u16(dst) = sample; goto PUT16_END;
448 put16_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT16_END;
449 put16_12_21: as_u16(dst) = bswap_16(sample); goto PUT16_END;
450 put16_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT16_END;
451 put16_12_0120: as_u32(dst) = sx24((uint32_t)sample << 8); goto PUT16_END;
452 put16_12_0920: as_u32(dst) = sx24((uint32_t)(sample ^ 0x8000) << 8); goto PUT16_END;
453 put16_12_0210: as_u32(dst) = sx24s((uint32_t)bswap_16(sample) << 8); goto PUT16_END;
454 put16_12_0290: as_u32(dst) = sx24s((uint32_t)(bswap_16(sample) ^ 0x80) << 8); goto PUT16_END;
455 put16_12_1200: as_u32(dst) = (uint32_t)sample << 16; goto PUT16_END;
456 put16_12_9200: as_u32(dst) = (uint32_t)(sample ^ 0x8000) << 16; goto PUT16_END;
457 put16_12_0021: as_u32(dst) = (uint32_t)bswap_16(sample); goto PUT16_END;
458 put16_12_0029: as_u32(dst) = (uint32_t)bswap_16(sample) ^ 0x80; goto PUT16_END;
459 put16_12_0120_20: as_u32(dst) = sx20((uint32_t)sample << 4); goto PUT16_END;
460 put16_12_0920_20: as_u32(dst) = sx20((uint32_t)(sample ^ 0x8000) << 4); goto PUT16_END;
461 put16_12_0210_20: as_u32(dst) = bswap_32(sx20((uint32_t)sample << 4)); goto PUT16_END;
462 put16_12_0290_20: as_u32(dst) = bswap_32(sx20((uint32_t)(sample ^ 0x8000) << 4)); goto PUT16_END;
463 put16_12_120: _put_triple(dst, (uint32_t)sample << 8); goto PUT16_END;
464 put16_12_920: _put_triple(dst, (uint32_t)(sample ^ 0x8000) << 8); goto PUT16_END;
465 put16_12_021: _put_triple_s(dst, (uint32_t)sample << 8); goto PUT16_END;
466 put16_12_029: _put_triple_s(dst, (uint32_t)(sample ^ 0x8000) << 8); goto PUT16_END;
467 put16_12_120_20: _put_triple(dst, (uint32_t)sample << 4); goto PUT16_END;
468 put16_12_920_20: _put_triple(dst, (uint32_t)(sample ^ 0x8000) << 4); goto PUT16_END;
469 put16_12_021_20: _put_triple_s(dst, (uint32_t)sample << 4); goto PUT16_END;
470 put16_12_029_20: _put_triple_s(dst, (uint32_t)(sample ^ 0x8000) << 4); goto PUT16_END;
471 put16_12_120_18: _put_triple(dst, (uint32_t)sample << 2); goto PUT16_END;
472 put16_12_920_18: _put_triple(dst, (uint32_t)(sample ^ 0x8000) << 2); goto PUT16_END;
473 put16_12_021_18: _put_triple_s(dst, (uint32_t)sample << 2); goto PUT16_END;
474 put16_12_029_18: _put_triple_s(dst, (uint32_t)(sample ^ 0x8000) << 2); goto PUT16_END;
475 }
476 #endif
477
478 #ifdef CONV24_LABELS
479 #define GET32_LABELS
480 #define PUT32_LABELS
481 #endif
482
483 #ifdef GET32_LABELS
484 /* src_wid src_endswap sign_toggle */
485 static void *const get32_labels[5 * 2 * 2 + 4 * 3] = {
486 &&get32_1_1000, /* 8h -> 32h */
487 &&get32_1_9000, /* 8h ^> 32h */
488 &&get32_1_1000, /* 8s -> 32h */
489 &&get32_1_9000, /* 8s ^> 32h */
490 &&get32_12_1200, /* 16h -> 32h */
491 &&get32_12_9200, /* 16h ^> 32h */
492 &&get32_12_2100, /* 16s -> 32h */
493 &&get32_12_A100, /* 16s ^> 32h */
494 /* 4 byte formats */
495 &&get32_0123_1230, /* 24h -> 32h */
496 &&get32_0123_9230, /* 24h ^> 32h */
497 &&get32_1230_3210, /* 24s -> 32h */
498 &&get32_1230_B210, /* 24s ^> 32h */
499 &&get32_1234_1234, /* 32h -> 32h */
500 &&get32_1234_9234, /* 32h ^> 32h */
501 &&get32_1234_4321, /* 32s -> 32h */
502 &&get32_1234_C321, /* 32s ^> 32h */
503 &&get32_0123_1230_20, /* 20h -> 32h */
504 &&get32_0123_9230_20, /* 20h ^> 32h */
505 &&get32_1230_3210_20, /* 20s -> 32h */
506 &&get32_1230_B210_20, /* 20s ^> 32h */
507 /* 3bytes format */
508 &&get32_123_1230, /* 24h -> 32h */
509 &&get32_123_9230, /* 24h ^> 32h */
510 &&get32_123_3210, /* 24s -> 32h */
511 &&get32_123_B210, /* 24s ^> 32h */
512 &&get32_123_1230_20, /* 20h -> 32h */
513 &&get32_123_9230_20, /* 20h ^> 32h */
514 &&get32_123_3210_20, /* 20s -> 32h */
515 &&get32_123_B210_20, /* 20s ^> 32h */
516 &&get32_123_1230_18, /* 18h -> 32h */
517 &&get32_123_9230_18, /* 18h ^> 32h */
518 &&get32_123_3210_18, /* 18s -> 32h */
519 &&get32_123_B210_18, /* 18s ^> 32h */
520 };
521 #endif
522
523 #ifdef CONV24_END
524 #define GET32_END __conv24_get
525 #endif
526
527 #ifdef GET32_END
528 while (0) {
529 get32_1_1000: sample = (uint32_t)as_u8c(src) << 24; goto GET32_END;
530 get32_1_9000: sample = (uint32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END;
531 get32_12_1200: sample = (uint32_t)as_u16c(src) << 16; goto GET32_END;
532 get32_12_9200: sample = (uint32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END;
533 get32_12_2100: sample = (uint32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END;
534 get32_12_A100: sample = (uint32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END;
535 get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END;
536 get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END;
537 get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END;
538 get32_1230_B210: sample = bswap_32((as_u32c(src) >> 8) ^ 0x80); goto GET32_END;
539 get32_1234_1234: sample = as_u32c(src); goto GET32_END;
540 get32_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GET32_END;
541 get32_1234_4321: sample = bswap_32(as_u32c(src)); goto GET32_END;
542 get32_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GET32_END;
543 get32_0123_1230_20: sample = as_u32c(src) << 12; goto GET32_END;
544 get32_0123_9230_20: sample = (as_u32c(src) << 12) ^ 0x80000000; goto GET32_END;
545 get32_1230_3210_20: sample = bswap_32(as_u32c(src)) << 12; goto GET32_END;
546 get32_1230_B210_20: sample = (bswap_32(as_u32c(src)) << 12) ^ 0x80000000; goto GET32_END;
547 get32_123_1230: sample = _get_triple(src) << 8; goto GET32_END;
548 get32_123_9230: sample = (_get_triple(src) << 8) ^ 0x80000000; goto GET32_END;
549 get32_123_3210: sample = _get_triple_s(src) << 8; goto GET32_END;
550 get32_123_B210: sample = (_get_triple_s(src) << 8) ^ 0x80000000; goto GET32_END;
551 get32_123_1230_20: sample = _get_triple(src) << 12; goto GET32_END;
552 get32_123_9230_20: sample = (_get_triple(src) << 12) ^ 0x80000000; goto GET32_END;
553 get32_123_3210_20: sample = _get_triple_s(src) << 12; goto GET32_END;
554 get32_123_B210_20: sample = (_get_triple_s(src) << 12) ^ 0x80000000; goto GET32_END;
555 get32_123_1230_18: sample = _get_triple(src) << 14; goto GET32_END;
556 get32_123_9230_18: sample = (_get_triple(src) << 14) ^ 0x80000000; goto GET32_END;
557 get32_123_3210_18: sample = _get_triple_s(src) << 14; goto GET32_END;
558 get32_123_B210_18: sample = (_get_triple_s(src) << 14) ^ 0x80000000; goto GET32_END;
559 }
560 #endif
561
562 #ifdef CONV24_END
563 __conv24_get: goto *put;
564 #define PUT32_END CONV24_END
565 #endif
566
567 #ifdef PUT32_LABELS
568 /* dst_wid dst_endswap sign_toggle */
569 static void *const put32_labels[5 * 2 * 2 + 4 * 3] = {
570 &&put32_1234_1, /* 32h -> 8h */
571 &&put32_1234_9, /* 32h ^> 8h */
572 &&put32_1234_1, /* 32h -> 8s */
573 &&put32_1234_9, /* 32h ^> 8s */
574 &&put32_1234_12, /* 32h -> 16h */
575 &&put32_1234_92, /* 32h ^> 16h */
576 &&put32_1234_21, /* 32h -> 16s */
577 &&put32_1234_29, /* 32h ^> 16s */
578 /* 4 byte formats */
579 &&put32_1234_0123, /* 32h -> 24h */
580 &&put32_1234_0923, /* 32h ^> 24h */
581 &&put32_1234_3210, /* 32h -> 24s */
582 &&put32_1234_3290, /* 32h ^> 24s */
583 &&put32_1234_1234, /* 32h -> 32h */
584 &&put32_1234_9234, /* 32h ^> 32h */
585 &&put32_1234_4321, /* 32h -> 32s */
586 &&put32_1234_4329, /* 32h ^> 32s */
587 &&put32_1234_0123_20, /* 32h -> 20h */
588 &&put32_1234_0923_20, /* 32h ^> 20h */
589 &&put32_1234_3210_20, /* 32h -> 20s */
590 &&put32_1234_3290_20, /* 32h ^> 20s */
591 /* 3bytes format */
592 &&put32_1234_123, /* 32h -> 24h */
593 &&put32_1234_923, /* 32h ^> 24h */
594 &&put32_1234_321, /* 32h -> 24s */
595 &&put32_1234_329, /* 32h ^> 24s */
596 &&put32_1234_123_20, /* 32h -> 20h */
597 &&put32_1234_923_20, /* 32h ^> 20h */
598 &&put32_1234_321_20, /* 32h -> 20s */
599 &&put32_1234_329_20, /* 32h ^> 20s */
600 &&put32_1234_123_18, /* 32h -> 18h */
601 &&put32_1234_923_18, /* 32h ^> 18h */
602 &&put32_1234_321_18, /* 32h -> 18s */
603 &&put32_1234_329_18, /* 32h ^> 18s */
604 };
605 #endif
606
607 #ifdef CONV24_LABELS
608 #undef GET32_LABELS
609 #undef PUT32_LABELS
610 #endif
611
612 #ifdef PUT32_END
613 while (0) {
614 put32_1234_1: as_u8(dst) = sample >> 24; goto PUT32_END;
615 put32_1234_9: as_u8(dst) = (sample >> 24) ^ 0x80; goto PUT32_END;
616 put32_1234_12: as_u16(dst) = sample >> 16; goto PUT32_END;
617 put32_1234_92: as_u16(dst) = (sample >> 16) ^ 0x8000; goto PUT32_END;
618 put32_1234_21: as_u16(dst) = bswap_16(sample >> 16); goto PUT32_END;
619 put32_1234_29: as_u16(dst) = bswap_16(sample >> 16) ^ 0x80; goto PUT32_END;
620 put32_1234_0123: as_u32(dst) = sx24(sample >> 8); goto PUT32_END;
621 put32_1234_0923: as_u32(dst) = sx24((sample >> 8) ^ 0x800000); goto PUT32_END;
622 put32_1234_3210: as_u32(dst) = sx24s(bswap_32(sample) << 8); goto PUT32_END;
623 put32_1234_3290: as_u32(dst) = sx24s((bswap_32(sample) ^ 0x80) << 8); goto PUT32_END;
624 put32_1234_1234: as_u32(dst) = sample; goto PUT32_END;
625 put32_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT32_END;
626 put32_1234_4321: as_u32(dst) = bswap_32(sample); goto PUT32_END;
627 put32_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT32_END;
628 put32_1234_0123_20: as_u32(dst) = sx20(sample >> 12); goto PUT32_END;
629 put32_1234_0923_20: as_u32(dst) = sx20((sample ^ 0x80000000) >> 12); goto PUT32_END;
630 put32_1234_3210_20: as_u32(dst) = bswap_32(sx20(sample >> 12)); goto PUT32_END;
631 put32_1234_3290_20: as_u32(dst) = bswap_32(sx20((sample ^ 0x80000000) >> 12)); goto PUT32_END;
632 put32_1234_123: _put_triple(dst, sample >> 8); goto PUT32_END;
633 put32_1234_923: _put_triple(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
634 put32_1234_321: _put_triple_s(dst, sample >> 8); goto PUT32_END;
635 put32_1234_329: _put_triple_s(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
636 put32_1234_123_20: _put_triple(dst, sample >> 12); goto PUT32_END;
637 put32_1234_923_20: _put_triple(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
638 put32_1234_321_20: _put_triple_s(dst, sample >> 12); goto PUT32_END;
639 put32_1234_329_20: _put_triple_s(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
640 put32_1234_123_18: _put_triple(dst, sample >> 14); goto PUT32_END;
641 put32_1234_923_18: _put_triple(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
642 put32_1234_321_18: _put_triple_s(dst, sample >> 14); goto PUT32_END;
643 put32_1234_329_18: _put_triple_s(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
644 }
645 #endif
646
647 #ifdef CONV24_END
648 #undef GET32_END
649 #undef PUT32_END
650 #endif
651
652 #ifdef PUT32F_LABELS
653 /* type (0 = float, 1 = float64), endswap */
654 static void *const put32float_labels[2 * 2] = {
655 &&put32f_1234_1234F, /* 32h -> (float)h */
656 &&put32f_1234_4321F, /* 32h -> (float)s */
657 &&put32f_1234_1234D, /* 32h -> (float64)h */
658 &&put32f_1234_4321D, /* 32h -> (float64)s */
659 };
660 #endif
661
662 #ifdef PUT32F_END
663 put32f_1234_1234F: as_float(dst) = (float_t)((int32_t)sample) / (float_t)0x80000000UL; goto PUT32F_END;
664 put32f_1234_4321F: tmp_float.f = (float_t)((int32_t)sample) / (float_t)0x80000000UL;
665 as_u32(dst) = bswap_32(tmp_float.i); goto PUT32F_END;
666 put32f_1234_1234D: as_double(dst) = (double_t)((int32_t)sample) / (double_t)0x80000000UL; goto PUT32F_END;
667 put32f_1234_4321D: tmp_double.d = (double_t)((int32_t)sample) / (double_t)0x80000000UL;
668 as_u64(dst) = bswap_64(tmp_double.l); goto PUT32F_END;
669 #endif
670
671 #ifdef GET32F_LABELS
672 /* type (0 = float, 1 = float64), endswap */
673 static void *const get32float_labels[2 * 2] = {
674 &&get32f_1234F_1234, /* (float)h -> 32h */
675 &&get32f_4321F_1234, /* (float)s -> 32h */
676 &&get32f_1234D_1234, /* (float64)h -> 32h */
677 &&get32f_4321D_1234, /* (float64)s -> 32h */
678 };
679 #endif
680
681 #ifdef GET32F_END
682 get32f_1234F_1234: tmp_float.f = as_floatc(src);
683 if (tmp_float.f >= 1.0)
684 sample = 0x7fffffff;
685 else if (tmp_float.f <= -1.0)
686 sample = 0x80000000;
687 else
688 sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
689 goto GET32F_END;
690 get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src));
691 if (tmp_float.f >= 1.0)
692 sample = 0x7fffffff;
693 else if (tmp_float.f <= -1.0)
694 sample = 0x80000000;
695 else
696 sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
697 goto GET32F_END;
698 get32f_1234D_1234: tmp_double.d = as_doublec(src);
699 if (tmp_double.d >= 1.0)
700 sample = 0x7fffffff;
701 else if (tmp_double.d <= -1.0)
702 sample = 0x80000000;
703 else
704 sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
705 goto GET32F_END;
706 get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src));
707 if (tmp_double.d >= 1.0)
708 sample = 0x7fffffff;
709 else if (tmp_double.d <= -1.0)
710 sample = 0x80000000;
711 else
712 sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
713 goto GET32F_END;
714 #endif
715
716 #undef as_u8
717 #undef as_u16
718 #undef as_u32
719 #undef as_s8
720 #undef as_s16
721 #undef as_s32
722 #undef as_float
723 #undef as_double
724
725 #undef as_u8c
726 #undef as_u16c
727 #undef as_u32c
728 #undef as_s8c
729 #undef as_s16c
730 #undef as_s32c
731 #undef as_floatc
732 #undef as_doublec
733
734 #undef _get_triple
735 #undef _get_triple_s
736 #undef _get_triple_le
737 #undef _get_triple_be
738 #undef _put_triple
739 #undef _put_triple_s
740 #undef _put_triple_le
741 #undef _put_triple_be
742
743