[asterisk-commits] seanbright: trunk r386931 - in /trunk: ./ include/asterisk/utils.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 30 08:48:16 CDT 2013


Author: seanbright
Date: Tue Apr 30 08:48:12 2013
New Revision: 386931

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386931
Log:
Use the proper lower bound when doing saturation arithmetic.

16 bit signed integers have a range of [-32768, 32768).  The existing code
was using the interval (-32768, 32768) instead.  This patch fixes that.
........

Merged revisions 386929 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 386930 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/utils.h

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: trunk/include/asterisk/utils.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/utils.h?view=diff&rev=386931&r1=386930&r2=386931
==============================================================================
--- trunk/include/asterisk/utils.h (original)
+++ trunk/include/asterisk/utils.h Tue Apr 30 08:48:12 2013
@@ -324,8 +324,8 @@
 	res = (int) *input + *value;
 	if (res > 32767)
 		*input = 32767;
-	else if (res < -32767)
-		*input = -32767;
+	else if (res < -32768)
+		*input = -32768;
 	else
 		*input = (short) res;
 }
@@ -337,8 +337,8 @@
 	res = (int) *input - *value;
 	if (res > 32767)
 		*input = 32767;
-	else if (res < -32767)
-		*input = -32767;
+	else if (res < -32768)
+		*input = -32768;
 	else
 		*input = (short) res;
 }
@@ -350,8 +350,8 @@
 	res = (int) *input * *value;
 	if (res > 32767)
 		*input = 32767;
-	else if (res < -32767)
-		*input = -32767;
+	else if (res < -32768)
+		*input = -32768;
 	else
 		*input = (short) res;
 }




More information about the asterisk-commits mailing list