[asterisk-commits] seanbright: branch 11 r386930 - in /branches/11: ./ include/asterisk/utils.h

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


Author: seanbright
Date: Tue Apr 30 08:46:53 2013
New Revision: 386930

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386930
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

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

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

Modified: branches/11/include/asterisk/utils.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/include/asterisk/utils.h?view=diff&rev=386930&r1=386929&r2=386930
==============================================================================
--- branches/11/include/asterisk/utils.h (original)
+++ branches/11/include/asterisk/utils.h Tue Apr 30 08:46:53 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