patch-fixed_h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --- libmad-0.15.1b.orig/fixed.h 2004-02-17 03:02:03.000000000 +0100
  2. +++ libmad-0.15.1b/fixed.h 2013-10-16 10:51:56.000000000 +0200
  3. @@ -275,12 +275,25 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t
  4. : "+r" (lo), "+r" (hi) \
  5. : "%r" (x), "r" (y))
  6. +#ifdef __thumb__
  7. +/* In Thumb-2, the RSB-immediate instruction is only allowed with a zero
  8. + operand. If needed this code can also support Thumb-1
  9. + (simply append "s" to the end of the second two instructions). */
  10. +# define MAD_F_MLN(hi, lo) \
  11. + asm ("rsbs %0, %0, #0\n\t" \
  12. + "sbc %1, %1, %1\n\t" \
  13. + "sub %1, %1, %2" \
  14. + : "+&r" (lo), "=&r" (hi) \
  15. + : "r" (hi) \
  16. + : "cc")
  17. +#else /* ! __thumb__ */
  18. # define MAD_F_MLN(hi, lo) \
  19. asm ("rsbs %0, %2, #0\n\t" \
  20. "rsc %1, %3, #0" \
  21. - : "=r" (lo), "=r" (hi) \
  22. + : "=&r" (lo), "=r" (hi) \
  23. : "0" (lo), "1" (hi) \
  24. : "cc")
  25. +#endif /* __thumb__ */
  26. # define mad_f_scale64(hi, lo) \
  27. ({ mad_fixed_t __result; \
  28. @@ -297,6 +310,14 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t
  29. /* --- MIPS ---------------------------------------------------------------- */
  30. +# elif defined(FPM_MIPS) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
  31. + typedef unsigned int u64_di_t __attribute__ ((mode (DI)));
  32. +# define MAD_F_MLX(hi, lo, x, y) \
  33. + do { \
  34. + u64_di_t __ll = (u64_di_t) (x) * (y); \
  35. + hi = __ll >> 32; \
  36. + lo = __ll; \
  37. + } while (0)
  38. # elif defined(FPM_MIPS)
  39. /*