summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-04-15 23:49:07 +0200
committerThomas Martitz <kugel@rockbox.org>2014-04-15 23:49:07 +0200
commit466441dc14f2463dbd48aa6ab268317269100e4a (patch)
treee45c579fdf1554f9f56aa8ea23d902b098c21235 /lib
parentbd10245e8940c05e9c4bfe13744571daf43a164a (diff)
downloadrockbox-466441dc14f2463dbd48aa6ab268317269100e4a.tar.gz
rockbox-466441dc14f2463dbd48aa6ab268317269100e4a.tar.bz2
rockbox-466441dc14f2463dbd48aa6ab268317269100e4a.zip
libmad: Use 32bit unsigned for requantize table.
Implicit promotion of integer literals to unsigned long introduced a subtle bug on 64-bit systems due to weird sign extensions (leads to audible glitches in a few files). The table is originally designed for unsigned 32bit integers, and it works with those so use them. As a consequence the lookup table size is halved as well. Change-Id: I35d878d6df03300387f0e403e0f3c3bdc73eea00
Diffstat (limited to 'lib')
-rw-r--r--lib/rbcodec/codecs/libmad/layer3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rbcodec/codecs/libmad/layer3.c b/lib/rbcodec/codecs/libmad/layer3.c
index ffb0fb20ff..48bb643b93 100644
--- a/lib/rbcodec/codecs/libmad/layer3.c
+++ b/lib/rbcodec/codecs/libmad/layer3.c
@@ -339,7 +339,7 @@ unsigned char const pretab[22] = {
* format rq_table: bit31-27=exponent bit26-0=mantissa
*/
static
-unsigned long const rq_table[8207] = {
+uint32_t const rq_table[8207] = {
# include "rq_table.dat"
};
@@ -885,7 +885,7 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp)
{
mad_fixed_t requantized;
signed int frac;
- unsigned long power;
+ uint32_t power;
frac = exp % 4; /* assumes sign(frac) == sign(exp) */
exp /= 4;