summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2005-07-30 13:47:16 +0000
committerMagnus Holmgren <magnushol@gmail.com>2005-07-30 13:47:16 +0000
commit059a6c86718457602ee7e30de3f9d68f78006154 (patch)
tree6194f9b5750823bf17e19d3996a763910bd100f8 /apps/dsp.c
parent6b807b2d248baee699eb2b5e43344cd278a7f01d (diff)
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
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index a7d61e6656..8537004636 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