Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/celt
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2022-07-03 05:46:14 +0300
committerJean-Marc Valin <jmvalin@amazon.com>2022-07-06 00:27:31 +0300
commit3cc09dee34a22f89385447fb7bd230140316281f (patch)
treeb1cceff4db35a0d87c2de544808b8b76c26df02d /celt
parente535e894196387b12d9fcbc271a98b21572a630b (diff)
Avoid left shifts of negative values in debug macros
Reviewed by Mark Harris
Diffstat (limited to 'celt')
-rw-r--r--celt/fixed_debug.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/celt/fixed_debug.h b/celt/fixed_debug.h
index 92f0f47a..c2cf5a83 100644
--- a/celt/fixed_debug.h
+++ b/celt/fixed_debug.h
@@ -167,7 +167,7 @@ static OPUS_INLINE short SHR16_(int a, int shift, char *file, int line)
#define SHL16(a, shift) SHL16_(a, shift, __FILE__, __LINE__)
static OPUS_INLINE short SHL16_(int a, int shift, char *file, int line)
{
- int res;
+ opus_int32 res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
{
fprintf (stderr, "SHL16: inputs are not short: %d %d in %s: line %d\n", a, shift, file, line);
@@ -175,7 +175,7 @@ static OPUS_INLINE short SHL16_(int a, int shift, char *file, int line)
celt_assert(0);
#endif
}
- res = a<<shift;
+ res = (opus_int32)((opus_uint32)a<<shift);
if (!VERIFY_SHORT(res))
{
fprintf (stderr, "SHL16: output is not short: %d in %s: line %d\n", res, file, line);
@@ -219,7 +219,7 @@ static OPUS_INLINE int SHL32_(opus_int64 a, int shift, char *file, int line)
celt_assert(0);
#endif
}
- res = a<<shift;
+ res = (opus_int64)((opus_uint64)a<<shift);
if (!VERIFY_INT(res))
{
fprintf (stderr, "SHL32: output is not int: %lld<<%d = %lld in %s: line %d\n", (long long)a, shift, (long long)res, file, line);