Changeset 149609 in webkit
- Timestamp:
- May 6, 2013 10:49:52 AM (11 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r149602 r149609 1 2013-05-06 Cosmin Truta <ctruta@blackberry.com> 2 3 Cherry-pick fixes to bignum from upstream 4 https://bugs.webkit.org/show_bug.cgi?id=115658 5 6 Reviewed by Darin Adler. 7 8 Cherry-picked the following change lists: 9 10 Fix bug in bignum implementation 11 http://codereview.chromium.org/13454019 12 13 Make VS2005 project files compile without errors 14 http://codereview.chromium.org/6286135 15 16 * wtf/dtoa/bignum.cc: 17 1 18 2013-05-06 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 2 19 -
trunk/Source/WTF/wtf/dtoa/bignum.cc
r147976 r149609 69 69 EnsureCapacity(needed_bigits); 70 70 for (int i = 0; i < needed_bigits; ++i) { 71 bigits_[i] = (uint32_t)value & kBigitMask;71 bigits_[i] = static_cast<Chunk>(value & kBigitMask); 72 72 value = value >> kBigitSize; 73 73 } … … 268 268 while (carry != 0) { 269 269 EnsureCapacity(used_digits_ + 1); 270 bigits_[used_digits_] = (uint32_t)carry & kBigitMask;270 bigits_[used_digits_] = static_cast<Chunk>(carry & kBigitMask); 271 271 used_digits_++; 272 272 carry >>= kBigitSize; … … 289 289 uint64_t product_high = high * bigits_[i]; 290 290 uint64_t tmp = (carry & kBigitMask) + product_low; 291 bigits_[i] = (uint32_t)tmp & kBigitMask;291 bigits_[i] = static_cast<Chunk>(tmp & kBigitMask); 292 292 carry = (carry >> kBigitSize) + (tmp >> kBigitSize) + 293 293 (product_high << (32 - kBigitSize)); … … 295 295 while (carry != 0) { 296 296 EnsureCapacity(used_digits_ + 1); 297 bigits_[used_digits_] = (uint32_t)carry & kBigitMask;297 bigits_[used_digits_] = static_cast<Chunk>(carry & kBigitMask); 298 298 used_digits_++; 299 299 carry >>= kBigitSize; … … 738 738 739 739 void Bignum::SubtractTimes(const Bignum& other, int factor) { 740 #ifndef NDEBUG 741 Bignum a, b; 742 a.AssignBignum(*this); 743 b.AssignBignum(other); 744 b.MultiplyByUInt32(factor); 745 a.SubtractBignum(b); 746 #endif 740 747 ASSERT(exponent_ <= other.exponent_); 741 748 if (factor < 3) { … … 750 757 DoubleChunk product = static_cast<DoubleChunk>(factor) * other.bigits_[i]; 751 758 DoubleChunk remove = borrow + product; 752 Chunk difference = bigits_[i + exponent_diff] - ((uint32_t)remove & kBigitMask); 759 Chunk difference = 760 bigits_[i + exponent_diff] - static_cast<Chunk>(remove & kBigitMask); 753 761 bigits_[i + exponent_diff] = difference & kBigitMask; 754 762 borrow = static_cast<Chunk>((difference >> (kChunkSize - 1)) + … … 760 768 bigits_[i] = difference & kBigitMask; 761 769 borrow = difference >> (kChunkSize - 1); 762 ++i;763 770 } 764 771 Clamp(); 772 ASSERT(Bignum::Equal(a, *this)); 765 773 } 766 774
Note: See TracChangeset
for help on using the changeset viewer.