[asterisk-commits] file: trunk r81326 - /trunk/include/asterisk/utils.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 28 21:21:09 CDT 2007


Author: file
Date: Tue Aug 28 21:21:08 2007
New Revision: 81326

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81326
Log:
Add inline function for signed linear subtraction.

Modified:
    trunk/include/asterisk/utils.h

Modified: trunk/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/utils.h?view=diff&rev=81326&r1=81325&r2=81326
==============================================================================
--- trunk/include/asterisk/utils.h (original)
+++ trunk/include/asterisk/utils.h Tue Aug 28 21:21:08 2007
@@ -276,6 +276,19 @@
 	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_subtract(short *input, short *value)
+{
+	int res;
+
+	res = (int) *input - *value;
 	if (res > 32767)
 		*input = 32767;
 	else if (res < -32767)




More information about the asterisk-commits mailing list