aboutsummaryrefslogtreecommitdiff
path: root/celt/fixed_debug.h
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-04-12 11:07:21 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-04-12 11:09:09 -0400
commit367c39486618fe6a6f9ffe85e834d59cae241253 (patch)
treec0135bdb19163c0be8d56ddf75897c38f639afe5 /celt/fixed_debug.h
parent7aecadda2f72cbf1f55209293dc63e01bb743035 (diff)
downloadlibopus-367c39486618fe6a6f9ffe85e834d59cae241253.tar.gz
Fixes several overflows in the CELT fixed-point
These were all mostly benign and would at worst result in (rare) suboptimal encoder decisions rather than signal corruption.
Diffstat (limited to 'celt/fixed_debug.h')
-rw-r--r--celt/fixed_debug.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/celt/fixed_debug.h b/celt/fixed_debug.h
index 0a1adf4c..4a34b5a6 100644
--- a/celt/fixed_debug.h
+++ b/celt/fixed_debug.h
@@ -154,17 +154,18 @@ static inline int SHR32(long long a, int shift)
celt_mips+=2;
return res;
}
-static inline int SHL32(long long a, int shift)
+#define SHL32(a, shift) SHL32_(a, shift, __FILE__, __LINE__)
+static inline int SHL32_(long long a, int shift, char *file, int line)
{
long long res;
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
{
- fprintf (stderr, "SHL32: inputs are not int: %d %d\n", (int)a, shift);
+ fprintf (stderr, "SHL32: inputs are not int: %lld %d in %s: line %d\n", a, shift, file, line);
}
res = a<<shift;
if (!VERIFY_INT(res))
{
- fprintf (stderr, "SHL32: output is not int: %d\n", (int)res);
+ fprintf (stderr, "SHL32: output is not int: %lld<<%d = %lld in %s: line %d\n", a, shift, res, file, line);
}
celt_mips+=2;
return res;