mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user