From 059a6c86718457602ee7e30de3f9d68f78006154 Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Sat, 30 Jul 2005 13:47:16 +0000 Subject: Make simulator version of FRACMUL correct. Also corrected related comments. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7261 a1c6a512-1295-4272-9138-f99709370657 --- apps/dsp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/dsp.c b/apps/dsp.c index a7d61e6..8537004 100644 --- a/apps/dsp.c +++ b/apps/dsp.c @@ -43,8 +43,8 @@ #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) #define INIT() asm volatile ("move.l #0xb0, %macsr") /* frac, round, clip */ -/* Multiply 2 32-bit integers and return the 32 most significant bits of the - * result. +/* Multiply two S.31 fractional integers and return the sign bit and the + * 31 most significant bits of the result. */ #define FRACMUL(x, y) \ ({ \ @@ -54,9 +54,8 @@ : [t] "=r" (t) : [a] "r" (x), [b] "r" (y)); \ t; \ }) -/* Multiply 2 32-bit integers and of the 40 most significat bits of the - * result, return the 32 least significant bits. I.e., like FRACMUL with one - * of the arguments shifted 8 bits to the right. +/* Multiply one S.31-bit and one S7.24 fractional integer and return the + * sign bit and the 31 most significant bits of the result. */ #define FRACMUL_8(x, y) \ ({ \ @@ -72,7 +71,7 @@ #else #define INIT() -#define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 32)) +#define FRACMUL(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 31)) #define FRACMUL_8(x, y) (long) (((((long long) (x)) * ((long long) (y))) >> 24)) #endif -- cgit v1.1