aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/utils.h
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-29 02:21:08 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-29 02:21:08 +0000
commit800fbaee68eb8a5a011e9b9948a038da9a739412 (patch)
tree8b8700fa35228cfb3c3c08c2895bc2b306537e6c /include/asterisk/utils.h
parent9a0a44d4b01b74a7a583efa952aed8e6927564e0 (diff)
Add inline function for signed linear subtraction.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@81326 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r--include/asterisk/utils.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 6f97770d9..d87ea0339 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -283,6 +283,19 @@ static force_inline void ast_slinear_saturated_add(short *input, short *value)
else
*input = (short) res;
}
+
+static force_inline void ast_slinear_saturated_subtract(short *input, short *value)
+{
+ int res;
+
+ res = (int) *input - *value;
+ if (res > 32767)
+ *input = 32767;
+ else if (res < -32767)
+ *input = -32767;
+ else
+ *input = (short) res;
+}
static force_inline void ast_slinear_saturated_multiply(short *input, short *value)
{