Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Dec 2015 22:09:02 GMT
From:      clord@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r295787 - soc2015/clord/head/sys/contrib/ficl
Message-ID:  <201512232209.tBNM927o043621@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: clord
Date: Wed Dec 23 22:09:02 2015
New Revision: 295787
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=295787

Log:
  Fix some math bugs. Credit to Toomas Soome from the Illumos project.
  
  Obtained from:	http://cr.illumos.org/~webrev/tsoome/ficl/usr/src/common/ficl/double.c.patch

Modified:
  soc2015/clord/head/sys/contrib/ficl/double.c

Modified: soc2015/clord/head/sys/contrib/ficl/double.c
==============================================================================
--- soc2015/clord/head/sys/contrib/ficl/double.c	Wed Dec 23 21:59:38 2015	(r295786)
+++ soc2015/clord/head/sys/contrib/ficl/double.c	Wed Dec 23 22:09:02 2015	(r295787)
@@ -159,7 +159,7 @@
 
 ficl2Integer ficl2IntegerDecrement(ficl2Integer x)
 {
-	if (x.low == INT_MIN)
+	if (x.low == INTMAX_MIN)
 		x.high--;
 	x.low--;
 
@@ -170,16 +170,11 @@
 ficl2Unsigned ficl2UnsignedAdd(ficl2Unsigned x, ficl2Unsigned y)
 {
     ficl2Unsigned result;
-    int carry;
     
     result.high = x.high + y.high;
     result.low = x.low + y.low;
 
-
-    carry  = ((x.low | y.low) & FICL_CELL_HIGH_BIT) && !(result.low & FICL_CELL_HIGH_BIT);
-    carry |= ((x.low & y.low) & FICL_CELL_HIGH_BIT);
-
-    if (carry)
+    if(result.low < y.low)
     {
         result.high++;
     }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512232209.tBNM927o043621>