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
This commit is contained in:
yangguo@chromium.org 2013-04-08 15:13:57 +00:00
parent b293d4d4a2
commit 26ef04fa9c

View File

@ -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));
}