diff options
Diffstat (limited to 'src/libfaad/fixed.h')
-rw-r--r-- | src/libfaad/fixed.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/libfaad/fixed.h b/src/libfaad/fixed.h index ae5e5cc4a..5fae855ab 100644 --- a/src/libfaad/fixed.h +++ b/src/libfaad/fixed.h @@ -16,7 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** -** $Id: fixed.h,v 1.1 2002/12/16 19:00:06 miguelfreitas Exp $ +** $Id: fixed.h,v 1.2 2003/04/12 14:58:47 miguelfreitas Exp $ **/ #ifndef __FIXED_H__ @@ -71,6 +71,38 @@ static INLINE MUL_R_C(real_t A, real_t B) } } +#elif defined(__GNUC__) && defined (__arm__) + +/* taken from MAD */ +#define arm_mul(x, y, SCALEBITS) \ + ({ uint32_t __hi; \ + uint32_t __lo; \ + uint32_t __result; \ + asm ("smull %0, %1, %3, %4\n\t" \ + "movs %0, %0, lsr %5\n\t" \ + "adc %2, %0, %1, lsl %6" \ + : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ + : "%r" (x), "r" (y), \ + "M" (SCALEBITS), "M" (32 - (SCALEBITS)) \ + : "cc"); \ + __result; \ + }) + +static INLINE real_t MUL(real_t A, real_t B) +{ + return arm_mul( A, B, REAL_BITS); +} + +static INLINE real_t MUL_C_C(real_t A, real_t B) +{ + return arm_mul( A, B, COEF_BITS); +} + +static INLINE real_t MUL_R_C(real_t A, real_t B) +{ + return arm_mul( A, B, COEF_BITS); +} + #else /* multiply real with real */ |