Revision: 14167
Author:   [email protected]
Date:     Mon Apr  8 08:13:57 2013
Log:      Fix bug in bignum implementation.

[email protected]
BUG=

Review URL: https://chromiumcodereview.appspot.com/13454019
http://code.google.com/p/v8/source/detail?r=14167

Modified:
 /branches/bleeding_edge/src/bignum.cc

=======================================
--- /branches/bleeding_edge/src/bignum.cc       Tue Jul  5 04:54:11 2011
+++ /branches/bleeding_edge/src/bignum.cc       Mon Apr  8 08:13:57 2013
@@ -735,6 +735,13 @@


 void Bignum::SubtractTimes(const Bignum& other, int factor) {
+#ifdef DEBUG
+  Bignum a, b;
+  a.AssignBignum(*this);
+  b.AssignBignum(other);
+  b.MultiplyByUInt32(factor);
+  a.SubtractBignum(b);
+#endif
   ASSERT(exponent_ <= other.exponent_);
   if (factor < 3) {
     for (int i = 0; i < factor; ++i) {
@@ -758,9 +765,9 @@
     Chunk difference = bigits_[i] - borrow;
     bigits_[i] = difference & kBigitMask;
     borrow = difference >> (kChunkSize - 1);
-    ++i;
   }
   Clamp();
+  ASSERT(Bignum::Equal(a, *this));
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to