Commit 26ef04fa authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix bug in bignum implementation.

R=mstarzinger@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/13454019

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14167 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b293d4d4
......@@ -735,6 +735,13 @@ void Bignum::BigitsShiftLeft(int shift_amount) {
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 @@ void Bignum::SubtractTimes(const Bignum& other, int factor) {
Chunk difference = bigits_[i] - borrow;
bigits_[i] = difference & kBigitMask;
borrow = difference >> (kChunkSize - 1);
++i;
}
Clamp();
ASSERT(Bignum::Equal(a, *this));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment