Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Platform][Decimal] UInt128::operator/= calls makeUInt128 with wrong …
…argument order

https://bugs.webkit.org/show_bug.cgi?id=88044

Reviewed by Kent Tamura.

Source/WebCore:

This patch fixed wrong argument of makeUInt128 in UInt128::operator/= to get right
result for decimal multiplication.

Test: WebKit/chromium/tests/DecimalTest.cpp: Add new a new test case.

* platform/Decimal.cpp:
(WebCore::DecimalPrivate::UInt128::operator/=):

Source/WebKit/chromium:

* tests/DecimalTest.cpp:
(TEST_F): Add a new test for multiplication.


Canonical link: https://commits.webkit.org/105884@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
yosinch committed Jun 1, 2012
1 parent 2c62dc7 commit a6adf07
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
15 changes: 15 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
2012-06-01 Yoshifumi Inoue <yosin@chromium.org>

[Platform][Decimal] UInt128::operator/= calls makeUInt128 with wrong argument order
https://bugs.webkit.org/show_bug.cgi?id=88044

Reviewed by Kent Tamura.

This patch fixed wrong argument of makeUInt128 in UInt128::operator/= to get right
result for decimal multiplication.

Test: WebKit/chromium/tests/DecimalTest.cpp: Add new a new test case.

* platform/Decimal.cpp:
(WebCore::DecimalPrivate::UInt128::operator/=):

2012-06-01 Adam Barth <abarth@webkit.org>

sandbox directive in X-WebKit-CSP header unable to create a unique origin
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/platform/Decimal.cpp
Expand Up @@ -168,7 +168,7 @@ UInt128& UInt128::operator/=(const uint32_t divisor)
uint32_t quotient[4];
uint32_t remainder = 0;
for (int i = 3; i >= 0; --i) {
const uint64_t work = makeUInt64(remainder, dividend[i]);
const uint64_t work = makeUInt64(dividend[i], remainder);
remainder = static_cast<uint32_t>(work % divisor);
quotient[i] = static_cast<uint32_t>(work / divisor);
}
Expand Down
10 changes: 10 additions & 0 deletions Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,13 @@
2012-06-01 Yoshifumi Inoue <yosin@chromium.org>

[Platform][Decimal] UInt128::operator/= calls makeUInt128 with wrong argument order
https://bugs.webkit.org/show_bug.cgi?id=88044

Reviewed by Kent Tamura.

* tests/DecimalTest.cpp:
(TEST_F): Add a new test for multiplication.

2012-05-31 Hajime Morrita <morrita@chromium.org>

REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/chromium/tests/DecimalTest.cpp
Expand Up @@ -646,6 +646,7 @@ TEST_F(DecimalTest, Multiplication)
EXPECT_EQ(encode(2, 0, Negative), Decimal(-1) * Decimal(2));
EXPECT_EQ(encode(99, 0, Positive), Decimal(99) * Decimal(1));
EXPECT_EQ(encode(2500, 0, Positive), Decimal(-50) * Decimal(-50));
EXPECT_EQ(encode(1, 21, Positive), encode(UINT64_C(10000000000), 0, Positive) * encode(UINT64_C(100000000000), 0, Positive));
}

TEST_F(DecimalTest, MultiplicationBigExponent)
Expand Down

0 comments on commit a6adf07

Please sign in to comment.