ref: abdfc38837bfdebdd5eacba6fa4f71dd7b0d1b52
parent: fa14707713d102a4e6d9aea4c3ff53677aa925eb
author: Jean-Marc Valin <[email protected]>
date: Fri Apr 18 11:57:18 EDT 2008
Saturation in SIG2INT16 using MIN/MAX
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -141,10 +141,8 @@
static inline celt_int16_t SIG2INT16(celt_sig_t x)
{
x = PSHR32(x, SIG_SHIFT);
- if (x>32767)
- x = 32767;
- else if (x<-32767)
- x = -32767;
+ x = MAX32(x, -32768);
+ x = MIN32(x, 32767);
#ifdef FIXED_POINT
return EXTRACT16(x);
#else