From 0497adffcf18e700215ce47f86eca0307a60bffc Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Thu, 26 May 2011 21:22:29 +0000 Subject: Commit FS#12130 - Fix ADX decoding on 64-bit systems by Sean Bartell. Fixes an incorrect assumption in the ADX decoder that sizeof(int) == 32 when performing fixed point math. Update comments in the fixed point library to correct this. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29927 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/adx.c | 2 +- apps/codecs/lib/fixedpoint.h | 2 +- apps/plugins/lib/fixedpoint.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c index a1b57fce58..e75e7dca1e 100644 --- a/apps/codecs/adx.c +++ b/apps/codecs/adx.c @@ -129,7 +129,7 @@ enum codec_status codec_run(void) fp_sincos((unsigned long)phasemultiple,&z); - a = (M_SQRT2*big28)-(z*big28/LONG_MAX); + a = (M_SQRT2*big28) - (z >> 3); /** * In the long passed to fsqrt there are only 4 nonfractional bits, diff --git a/apps/codecs/lib/fixedpoint.h b/apps/codecs/lib/fixedpoint.h index b912cbe66b..1cbd1573bb 100644 --- a/apps/codecs/lib/fixedpoint.h +++ b/apps/codecs/lib/fixedpoint.h @@ -33,7 +33,7 @@ * where phase is a 32 bit unsigned integer with 0 representing 0 * and 0xFFFFFFFF representing 2*pi, and *cos is the address to * a long signed integer. Value returned is a long signed integer - * from LONG_MIN to LONG_MAX, representing -1 to 1 respectively. + * from -0x80000000 to 0x7fffffff, representing -1 to 1 respectively. * That is, value is a fixed point integer with 31 fractional bits. * * Take square root of a fixed point number: diff --git a/apps/plugins/lib/fixedpoint.h b/apps/plugins/lib/fixedpoint.h index 7cb0098129..1631f8d6d8 100644 --- a/apps/plugins/lib/fixedpoint.h +++ b/apps/plugins/lib/fixedpoint.h @@ -33,7 +33,7 @@ * where phase is a 32 bit unsigned integer with 0 representing 0 * and 0xFFFFFFFF representing 2*pi, and *cos is the address to * a long signed integer. Value returned is a long signed integer - * from LONG_MIN to LONG_MAX, representing -1 to 1 respectively. + * from -0x80000000 to 0x7fffffff, representing -1 to 1 respectively. * That is, value is a fixed point integer with 31 fractional bits. * * Take square root of a fixed point number: -- cgit v1.2.3