]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
Bugfix. Unsigned modulus of zero returned 1, it should return 0.
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Fri, 1 Oct 2010 14:35:44 +0000 (14:35 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Fri, 1 Oct 2010 14:35:44 +0000 (14:35 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1023 e59a4935-1847-0410-ae03-e826735625c1

src/simplifier/consteval.cpp

index d0ddeab29a40ecb9429b2c1ba50cc3a3482ec6fa..a5d8b6692051eaff639d1d223a98359363b323e6 100644 (file)
@@ -450,8 +450,14 @@ namespace BEEV
           if (_bm->UserFlags.division_by_zero_returns_one_flag 
               && CONSTANTBV::BitVector_is_empty(tmp1))
             {
-              // Expecting a division by zero. Just return one.
-              OutputNode = _bm->CreateOneConst(outputwidth);
+              // a = bq + r, where b!=0 implies r < b. q is quotient, r remainder. i.e. a/b = q.
+              // It doesn't matter what q is when b=0, but r needs to be 0.
+              if (k == BVMOD)
+                OutputNode = _bm->CreateZeroConst(outputwidth);
+              else
+                OutputNode = _bm->CreateOneConst(outputwidth);
+                // Expecting a division by zero. Just return one.
+
             }
           else
             {