diff options
Diffstat (limited to 'apps/codecs/libmad/fixed.h')
-rw-r--r-- | apps/codecs/libmad/fixed.h | 238 |
1 files changed, 119 insertions, 119 deletions
diff --git a/apps/codecs/libmad/fixed.h b/apps/codecs/libmad/fixed.h index 7e580c4e8f..84bb5954e3 100644 --- a/apps/codecs/libmad/fixed.h +++ b/apps/codecs/libmad/fixed.h | |||
@@ -64,50 +64,50 @@ typedef mad_fixed_t mad_sample_t; | |||
64 | * supported, and must be done with care. | 64 | * supported, and must be done with care. |
65 | */ | 65 | */ |
66 | 66 | ||
67 | # define MAD_F_FRACBITS 28 | 67 | # define MAD_F_FRACBITS 28 |
68 | 68 | ||
69 | # if MAD_F_FRACBITS == 28 | 69 | # if MAD_F_FRACBITS == 28 |
70 | # define MAD_F(x) ((mad_fixed_t) (x##L)) | 70 | # define MAD_F(x) ((mad_fixed_t) (x##L)) |
71 | # else | 71 | # else |
72 | # if MAD_F_FRACBITS < 28 | 72 | # if MAD_F_FRACBITS < 28 |
73 | # warning "MAD_F_FRACBITS < 28" | 73 | # warning "MAD_F_FRACBITS < 28" |
74 | # define MAD_F(x) ((mad_fixed_t) \ | 74 | # define MAD_F(x) ((mad_fixed_t) \ |
75 | (((x##L) + \ | 75 | (((x##L) + \ |
76 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ | 76 | (1L << (28 - MAD_F_FRACBITS - 1))) >> \ |
77 | (28 - MAD_F_FRACBITS))) | 77 | (28 - MAD_F_FRACBITS))) |
78 | # elif MAD_F_FRACBITS > 28 | 78 | # elif MAD_F_FRACBITS > 28 |
79 | # error "MAD_F_FRACBITS > 28 not currently supported" | 79 | # error "MAD_F_FRACBITS > 28 not currently supported" |
80 | # define MAD_F(x) ((mad_fixed_t) \ | 80 | # define MAD_F(x) ((mad_fixed_t) \ |
81 | ((x##L) << (MAD_F_FRACBITS - 28))) | 81 | ((x##L) << (MAD_F_FRACBITS - 28))) |
82 | # endif | 82 | # endif |
83 | # endif | 83 | # endif |
84 | 84 | ||
85 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) | 85 | # define MAD_F_MIN ((mad_fixed_t) -0x80000000L) |
86 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) | 86 | # define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL) |
87 | 87 | ||
88 | # define MAD_F_ONE MAD_F(0x10000000) | 88 | # define MAD_F_ONE MAD_F(0x10000000) |
89 | 89 | ||
90 | # define mad_f_tofixed(x) ((mad_fixed_t) \ | 90 | # define mad_f_tofixed(x) ((mad_fixed_t) \ |
91 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) | 91 | ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5)) |
92 | # define mad_f_todouble(x) ((double) \ | 92 | # define mad_f_todouble(x) ((double) \ |
93 | ((x) / (double) (1L << MAD_F_FRACBITS))) | 93 | ((x) / (double) (1L << MAD_F_FRACBITS))) |
94 | 94 | ||
95 | # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) | 95 | # define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS) |
96 | # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) | 96 | # define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1)) |
97 | /* (x should be positive) */ | 97 | /* (x should be positive) */ |
98 | 98 | ||
99 | # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) | 99 | # define mad_f_fromint(x) ((x) << MAD_F_FRACBITS) |
100 | 100 | ||
101 | # define mad_f_add(x, y) ((x) + (y)) | 101 | # define mad_f_add(x, y) ((x) + (y)) |
102 | # define mad_f_sub(x, y) ((x) - (y)) | 102 | # define mad_f_sub(x, y) ((x) - (y)) |
103 | 103 | ||
104 | # if defined(FPM_FLOAT) | 104 | # if defined(FPM_FLOAT) |
105 | # error "FPM_FLOAT not yet supported" | 105 | # error "FPM_FLOAT not yet supported" |
106 | 106 | ||
107 | # undef MAD_F | 107 | # undef MAD_F |
108 | # define MAD_F(x) mad_f_todouble(x) | 108 | # define MAD_F(x) mad_f_todouble(x) |
109 | 109 | ||
110 | # define mad_f_mul(x, y) ((x) * (y)) | 110 | # define mad_f_mul(x, y) ((x) * (y)) |
111 | # define mad_f_scale64 | 111 | # define mad_f_scale64 |
112 | 112 | ||
113 | # undef ASO_ZEROCHECK | 113 | # undef ASO_ZEROCHECK |
@@ -154,7 +154,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
154 | } | 154 | } |
155 | # pragma warning(pop) | 155 | # pragma warning(pop) |
156 | 156 | ||
157 | # define mad_f_mul mad_f_mul_inline | 157 | # define mad_f_mul mad_f_mul_inline |
158 | # define mad_f_scale64 | 158 | # define mad_f_scale64 |
159 | # else | 159 | # else |
160 | /* | 160 | /* |
@@ -163,9 +163,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
163 | */ | 163 | */ |
164 | # define MAD_F_MLX(hi, lo, x, y) \ | 164 | # define MAD_F_MLX(hi, lo, x, y) \ |
165 | asm ("imull %3" \ | 165 | asm ("imull %3" \ |
166 | : "=a" (lo), "=d" (hi) \ | 166 | : "=a" (lo), "=d" (hi) \ |
167 | : "%a" (x), "rm" (y) \ | 167 | : "%a" (x), "rm" (y) \ |
168 | : "cc") | 168 | : "cc") |
169 | 169 | ||
170 | # if defined(OPT_ACCURACY) | 170 | # if defined(OPT_ACCURACY) |
171 | /* | 171 | /* |
@@ -176,10 +176,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
176 | mad_fixed64lo_t __lo; \ | 176 | mad_fixed64lo_t __lo; \ |
177 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 177 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
178 | asm ("addl %2,%0\n\t" \ | 178 | asm ("addl %2,%0\n\t" \ |
179 | "adcl %3,%1" \ | 179 | "adcl %3,%1" \ |
180 | : "=rm" (lo), "=rm" (hi) \ | 180 | : "=rm" (lo), "=rm" (hi) \ |
181 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ | 181 | : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \ |
182 | : "cc"); \ | 182 | : "cc"); \ |
183 | }) | 183 | }) |
184 | # endif /* OPT_ACCURACY */ | 184 | # endif /* OPT_ACCURACY */ |
185 | 185 | ||
@@ -192,15 +192,15 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
192 | mad_fixed64lo_t __lo_; \ | 192 | mad_fixed64lo_t __lo_; \ |
193 | mad_fixed_t __result; \ | 193 | mad_fixed_t __result; \ |
194 | asm ("addl %4,%2\n\t" \ | 194 | asm ("addl %4,%2\n\t" \ |
195 | "adcl %5,%3" \ | 195 | "adcl %5,%3" \ |
196 | : "=rm" (__lo_), "=rm" (__hi_) \ | 196 | : "=rm" (__lo_), "=rm" (__hi_) \ |
197 | : "0" (lo), "1" (hi), \ | 197 | : "0" (lo), "1" (hi), \ |
198 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ | 198 | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ |
199 | : "cc"); \ | 199 | : "cc"); \ |
200 | asm ("shrdl %3,%2,%1" \ | 200 | asm ("shrdl %3,%2,%1" \ |
201 | : "=rm" (__result) \ | 201 | : "=rm" (__result) \ |
202 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ | 202 | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ |
203 | : "cc"); \ | 203 | : "cc"); \ |
204 | __result; \ | 204 | __result; \ |
205 | }) | 205 | }) |
206 | # elif defined(OPT_INTEL) | 206 | # elif defined(OPT_INTEL) |
@@ -210,21 +210,21 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
210 | # define mad_f_scale64(hi, lo) \ | 210 | # define mad_f_scale64(hi, lo) \ |
211 | ({ mad_fixed_t __result; \ | 211 | ({ mad_fixed_t __result; \ |
212 | asm ("shrl %3,%1\n\t" \ | 212 | asm ("shrl %3,%1\n\t" \ |
213 | "shll %4,%2\n\t" \ | 213 | "shll %4,%2\n\t" \ |
214 | "orl %2,%1" \ | 214 | "orl %2,%1" \ |
215 | : "=rm" (__result) \ | 215 | : "=rm" (__result) \ |
216 | : "0" (lo), "r" (hi), \ | 216 | : "0" (lo), "r" (hi), \ |
217 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ | 217 | "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ |
218 | : "cc"); \ | 218 | : "cc"); \ |
219 | __result; \ | 219 | __result; \ |
220 | }) | 220 | }) |
221 | # else | 221 | # else |
222 | # define mad_f_scale64(hi, lo) \ | 222 | # define mad_f_scale64(hi, lo) \ |
223 | ({ mad_fixed_t __result; \ | 223 | ({ mad_fixed_t __result; \ |
224 | asm ("shrdl %3,%2,%1" \ | 224 | asm ("shrdl %3,%2,%1" \ |
225 | : "=rm" (__result) \ | 225 | : "=rm" (__result) \ |
226 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ | 226 | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ |
227 | : "cc"); \ | 227 | : "cc"); \ |
228 | __result; \ | 228 | __result; \ |
229 | }) | 229 | }) |
230 | # endif /* OPT_ACCURACY */ | 230 | # endif /* OPT_ACCURACY */ |
@@ -249,42 +249,42 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
249 | ({ mad_fixed64hi_t __hi; \ | 249 | ({ mad_fixed64hi_t __hi; \ |
250 | mad_fixed64lo_t __lo; \ | 250 | mad_fixed64lo_t __lo; \ |
251 | mad_fixed_t __result; \ | 251 | mad_fixed_t __result; \ |
252 | asm ("smull %0, %1, %3, %4\n\t" \ | 252 | asm ("smull %0, %1, %3, %4\n\t" \ |
253 | "movs %0, %0, lsr %5\n\t" \ | 253 | "movs %0, %0, lsr %5\n\t" \ |
254 | "adc %2, %0, %1, lsl %6" \ | 254 | "adc %2, %0, %1, lsl %6" \ |
255 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ | 255 | : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ |
256 | : "%r" (x), "r" (y), \ | 256 | : "%r" (x), "r" (y), \ |
257 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 257 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
258 | : "cc"); \ | 258 | : "cc"); \ |
259 | __result; \ | 259 | __result; \ |
260 | }) | 260 | }) |
261 | # endif | 261 | # endif |
262 | 262 | ||
263 | # define MAD_F_MLX(hi, lo, x, y) \ | 263 | # define MAD_F_MLX(hi, lo, x, y) \ |
264 | asm ("smull %0, %1, %2, %3" \ | 264 | asm ("smull %0, %1, %2, %3" \ |
265 | : "=&r" (lo), "=&r" (hi) \ | 265 | : "=&r" (lo), "=&r" (hi) \ |
266 | : "%r" (x), "r" (y)) | 266 | : "%r" (x), "r" (y)) |
267 | 267 | ||
268 | # define MAD_F_MLA(hi, lo, x, y) \ | 268 | # define MAD_F_MLA(hi, lo, x, y) \ |
269 | asm ("smlal %0, %1, %2, %3" \ | 269 | asm ("smlal %0, %1, %2, %3" \ |
270 | : "+r" (lo), "+r" (hi) \ | 270 | : "+r" (lo), "+r" (hi) \ |
271 | : "%r" (x), "r" (y)) | 271 | : "%r" (x), "r" (y)) |
272 | 272 | ||
273 | # define MAD_F_MLN(hi, lo) \ | 273 | # define MAD_F_MLN(hi, lo) \ |
274 | asm ("rsbs %0, %2, #0\n\t" \ | 274 | asm ("rsbs %0, %2, #0\n\t" \ |
275 | "rsc %1, %3, #0" \ | 275 | "rsc %1, %3, #0" \ |
276 | : "=r" (lo), "=r" (hi) \ | 276 | : "=r" (lo), "=r" (hi) \ |
277 | : "0" (lo), "1" (hi) \ | 277 | : "0" (lo), "1" (hi) \ |
278 | : "cc") | 278 | : "cc") |
279 | 279 | ||
280 | # define mad_f_scale64(hi, lo) \ | 280 | # define mad_f_scale64(hi, lo) \ |
281 | ({ mad_fixed_t __result; \ | 281 | ({ mad_fixed_t __result; \ |
282 | asm ("movs %0, %1, lsr %3\n\t" \ | 282 | asm ("movs %0, %1, lsr %3\n\t" \ |
283 | "adc %0, %0, %2, lsl %4" \ | 283 | "adc %0, %0, %2, lsl %4" \ |
284 | : "=&r" (__result) \ | 284 | : "=&r" (__result) \ |
285 | : "r" (lo), "r" (hi), \ | 285 | : "r" (lo), "r" (hi), \ |
286 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ | 286 | "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \ |
287 | : "cc"); \ | 287 | : "cc"); \ |
288 | __result; \ | 288 | __result; \ |
289 | }) | 289 | }) |
290 | 290 | ||
@@ -299,28 +299,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
299 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). | 299 | * significant bit depends on OPT_ACCURACY via mad_f_scale64(). |
300 | */ | 300 | */ |
301 | # define MAD_F_MLX(hi, lo, x, y) \ | 301 | # define MAD_F_MLX(hi, lo, x, y) \ |
302 | asm ("mult %2,%3" \ | 302 | asm ("mult %2,%3" \ |
303 | : "=l" (lo), "=h" (hi) \ | 303 | : "=l" (lo), "=h" (hi) \ |
304 | : "%r" (x), "r" (y)) | 304 | : "%r" (x), "r" (y)) |
305 | 305 | ||
306 | # if defined(HAVE_MADD_ASM) | 306 | # if defined(HAVE_MADD_ASM) |
307 | # define MAD_F_MLA(hi, lo, x, y) \ | 307 | # define MAD_F_MLA(hi, lo, x, y) \ |
308 | asm ("madd %2,%3" \ | 308 | asm ("madd %2,%3" \ |
309 | : "+l" (lo), "+h" (hi) \ | 309 | : "+l" (lo), "+h" (hi) \ |
310 | : "%r" (x), "r" (y)) | 310 | : "%r" (x), "r" (y)) |
311 | # elif defined(HAVE_MADD16_ASM) | 311 | # elif defined(HAVE_MADD16_ASM) |
312 | /* | 312 | /* |
313 | * This loses significant accuracy due to the 16-bit integer limit in the | 313 | * This loses significant accuracy due to the 16-bit integer limit in the |
314 | * multiply/accumulate instruction. | 314 | * multiply/accumulate instruction. |
315 | */ | 315 | */ |
316 | # define MAD_F_ML0(hi, lo, x, y) \ | 316 | # define MAD_F_ML0(hi, lo, x, y) \ |
317 | asm ("mult %2,%3" \ | 317 | asm ("mult %2,%3" \ |
318 | : "=l" (lo), "=h" (hi) \ | 318 | : "=l" (lo), "=h" (hi) \ |
319 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 319 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
320 | # define MAD_F_MLA(hi, lo, x, y) \ | 320 | # define MAD_F_MLA(hi, lo, x, y) \ |
321 | asm ("madd16 %2,%3" \ | 321 | asm ("madd16 %2,%3" \ |
322 | : "+l" (lo), "+h" (hi) \ | 322 | : "+l" (lo), "+h" (hi) \ |
323 | : "%r" ((x) >> 12), "r" ((y) >> 16)) | 323 | : "%r" ((x) >> 12), "r" ((y) >> 16)) |
324 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) | 324 | # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) |
325 | # endif | 325 | # endif |
326 | 326 | ||
@@ -340,9 +340,9 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
340 | */ | 340 | */ |
341 | # define MAD_F_MLX(hi, lo, x, y) \ | 341 | # define MAD_F_MLX(hi, lo, x, y) \ |
342 | asm ("smul %2, %3, %0\n\t" \ | 342 | asm ("smul %2, %3, %0\n\t" \ |
343 | "rd %%y, %1" \ | 343 | "rd %%y, %1" \ |
344 | : "=r" (lo), "=r" (hi) \ | 344 | : "=r" (lo), "=r" (hi) \ |
345 | : "%r" (x), "rI" (y)) | 345 | : "%r" (x), "rI" (y)) |
346 | 346 | ||
347 | /* --- PowerPC ------------------------------------------------------------- */ | 347 | /* --- PowerPC ------------------------------------------------------------- */ |
348 | 348 | ||
@@ -355,11 +355,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
355 | # define MAD_F_MLX(hi, lo, x, y) \ | 355 | # define MAD_F_MLX(hi, lo, x, y) \ |
356 | do { \ | 356 | do { \ |
357 | asm ("mullw %0,%1,%2" \ | 357 | asm ("mullw %0,%1,%2" \ |
358 | : "=r" (lo) \ | 358 | : "=r" (lo) \ |
359 | : "%r" (x), "r" (y)); \ | 359 | : "%r" (x), "r" (y)); \ |
360 | asm ("mulhw %0,%1,%2" \ | 360 | asm ("mulhw %0,%1,%2" \ |
361 | : "=r" (hi) \ | 361 | : "=r" (hi) \ |
362 | : "%r" (x), "r" (y)); \ | 362 | : "%r" (x), "r" (y)); \ |
363 | } \ | 363 | } \ |
364 | while (0) | 364 | while (0) |
365 | 365 | ||
@@ -372,11 +372,11 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
372 | mad_fixed64lo_t __lo; \ | 372 | mad_fixed64lo_t __lo; \ |
373 | MAD_F_MLX(__hi, __lo, (x), (y)); \ | 373 | MAD_F_MLX(__hi, __lo, (x), (y)); \ |
374 | asm ("addc %0,%2,%3\n\t" \ | 374 | asm ("addc %0,%2,%3\n\t" \ |
375 | "adde %1,%4,%5" \ | 375 | "adde %1,%4,%5" \ |
376 | : "=r" (lo), "=r" (hi) \ | 376 | : "=r" (lo), "=r" (hi) \ |
377 | : "%r" (lo), "r" (__lo), \ | 377 | : "%r" (lo), "r" (__lo), \ |
378 | "%r" (hi), "r" (__hi) \ | 378 | "%r" (hi), "r" (__hi) \ |
379 | : "xer"); \ | 379 | : "xer"); \ |
380 | }) | 380 | }) |
381 | # endif | 381 | # endif |
382 | 382 | ||
@@ -387,28 +387,28 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
387 | # define mad_f_scale64(hi, lo) \ | 387 | # define mad_f_scale64(hi, lo) \ |
388 | ({ mad_fixed_t __result, __round; \ | 388 | ({ mad_fixed_t __result, __round; \ |
389 | asm ("rotrwi %0,%1,%2" \ | 389 | asm ("rotrwi %0,%1,%2" \ |
390 | : "=r" (__result) \ | 390 | : "=r" (__result) \ |
391 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ | 391 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
392 | asm ("extrwi %0,%1,1,0" \ | 392 | asm ("extrwi %0,%1,1,0" \ |
393 | : "=r" (__round) \ | 393 | : "=r" (__round) \ |
394 | : "r" (__result)); \ | 394 | : "r" (__result)); \ |
395 | asm ("insrwi %0,%1,%2,0" \ | 395 | asm ("insrwi %0,%1,%2,0" \ |
396 | : "+r" (__result) \ | 396 | : "+r" (__result) \ |
397 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | 397 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
398 | asm ("add %0,%1,%2" \ | 398 | asm ("add %0,%1,%2" \ |
399 | : "=r" (__result) \ | 399 | : "=r" (__result) \ |
400 | : "%r" (__result), "r" (__round)); \ | 400 | : "%r" (__result), "r" (__round)); \ |
401 | __result; \ | 401 | __result; \ |
402 | }) | 402 | }) |
403 | # else | 403 | # else |
404 | # define mad_f_scale64(hi, lo) \ | 404 | # define mad_f_scale64(hi, lo) \ |
405 | ({ mad_fixed_t __result; \ | 405 | ({ mad_fixed_t __result; \ |
406 | asm ("rotrwi %0,%1,%2" \ | 406 | asm ("rotrwi %0,%1,%2" \ |
407 | : "=r" (__result) \ | 407 | : "=r" (__result) \ |
408 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ | 408 | : "r" (lo), "i" (MAD_F_SCALEBITS)); \ |
409 | asm ("insrwi %0,%1,%2,0" \ | 409 | asm ("insrwi %0,%1,%2,0" \ |
410 | : "+r" (__result) \ | 410 | : "+r" (__result) \ |
411 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ | 411 | : "r" (hi), "i" (MAD_F_SCALEBITS)); \ |
412 | __result; \ | 412 | __result; \ |
413 | }) | 413 | }) |
414 | # endif | 414 | # endif |
@@ -452,10 +452,10 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
452 | * Pre-rounding is required to stay within the limits of compliance. | 452 | * Pre-rounding is required to stay within the limits of compliance. |
453 | */ | 453 | */ |
454 | # if defined(OPT_SPEED) | 454 | # if defined(OPT_SPEED) |
455 | # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) | 455 | # define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16)) |
456 | # else | 456 | # else |
457 | # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ | 457 | # define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \ |
458 | (((y) + (1L << 15)) >> 16)) | 458 | (((y) + (1L << 15)) >> 16)) |
459 | # endif | 459 | # endif |
460 | 460 | ||
461 | /* ------------------------------------------------------------------------- */ | 461 | /* ------------------------------------------------------------------------- */ |
@@ -476,22 +476,22 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
476 | # endif | 476 | # endif |
477 | 477 | ||
478 | # if !defined(MAD_F_MLA) | 478 | # if !defined(MAD_F_MLA) |
479 | # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) | 479 | # define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y))) |
480 | # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) | 480 | # define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y))) |
481 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) | 481 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) |
482 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 482 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
483 | # endif | 483 | # endif |
484 | 484 | ||
485 | # if !defined(MAD_F_ML0) | 485 | # if !defined(MAD_F_ML0) |
486 | # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) | 486 | # define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y)) |
487 | # endif | 487 | # endif |
488 | 488 | ||
489 | # if !defined(MAD_F_MLN) | 489 | # if !defined(MAD_F_MLN) |
490 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) | 490 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) |
491 | # endif | 491 | # endif |
492 | 492 | ||
493 | # if !defined(MAD_F_MLZ) | 493 | # if !defined(MAD_F_MLZ) |
494 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) | 494 | # define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo)) |
495 | # endif | 495 | # endif |
496 | 496 | ||
497 | # if !defined(mad_f_scale64) | 497 | # if !defined(mad_f_scale64) |
@@ -499,7 +499,7 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | |||
499 | # define mad_f_scale64(hi, lo) \ | 499 | # define mad_f_scale64(hi, lo) \ |
500 | ((((mad_fixed_t) \ | 500 | ((((mad_fixed_t) \ |
501 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ | 501 | (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \ |
502 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) | 502 | ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1) |
503 | # else | 503 | # else |
504 | # define mad_f_scale64(hi, lo) \ | 504 | # define mad_f_scale64(hi, lo) \ |
505 | ((mad_fixed_t) \ | 505 | ((mad_fixed_t) \ |