do saturated math properly (thanks to the eagle-eyes of Tony Mountifield)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Kevin P. Fleming 20 years ago
parent 80fb221f10
commit 15ac76178a

@ -173,7 +173,7 @@ static inline void ast_slinear_saturated_add(short *input, short value)
{
int res;
res = *input + value;
res = (int) *input + value;
if (res > 32767)
*input = 32767;
else if (res < -32767)
@ -186,7 +186,7 @@ static inline void ast_slinear_saturated_multiply(short *input, short value)
{
int res;
res = *input * value;
res = (int) *input * value;
if (res > 32767)
*input = 32767;
else if (res < -32767)

Loading…
Cancel
Save