Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp

Issue 1456173004: wtf: Eliminate inliner abuse in saturatedSet function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp
diff --git a/third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp b/third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp
index 6a8cee55b2d6ecf6fd60326dfea5bd17a4de7c12..45e3062b57055feeabdd874f59987a2db1e9f3c4 100644
--- a/third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp
+++ b/third_party/WebKit/Source/wtf/SaturatedArithmeticTest.cpp
@@ -110,30 +110,30 @@ TEST(SaturatedArithmeticTest, SetSigned)
const int intMaxForLayoutUnit = INT_MAX >> kFractionBits;
const int intMinForLayoutUnit = INT_MIN >> kFractionBits;
- EXPECT_EQ(0, saturatedSet(0, kFractionBits));
+ EXPECT_EQ(0, saturatedSet<kFractionBits>(0));
// Internally the max number we can represent (without saturating)
// is all the (non-sign) bits set except for the bottom n fraction bits
const int maxInternalRepresentation = INT_MAX ^ ((1 << kFractionBits)-1);
EXPECT_EQ(maxInternalRepresentation,
- saturatedSet(intMaxForLayoutUnit, kFractionBits));
+ saturatedSet<kFractionBits>(intMaxForLayoutUnit));
EXPECT_EQ(getMaxSaturatedSetResultForTesting(kFractionBits),
- saturatedSet(intMaxForLayoutUnit + 100, kFractionBits));
+ saturatedSet<kFractionBits>(intMaxForLayoutUnit + 100));
EXPECT_EQ((intMaxForLayoutUnit - 100) << kFractionBits,
- saturatedSet(intMaxForLayoutUnit - 100, kFractionBits));
+ saturatedSet<kFractionBits>(intMaxForLayoutUnit - 100));
EXPECT_EQ(getMinSaturatedSetResultForTesting(kFractionBits),
- saturatedSet(intMinForLayoutUnit, kFractionBits));
+ saturatedSet<kFractionBits>(intMinForLayoutUnit));
EXPECT_EQ(getMinSaturatedSetResultForTesting(kFractionBits),
- saturatedSet(intMinForLayoutUnit - 100, kFractionBits));
+ saturatedSet<kFractionBits>(intMinForLayoutUnit - 100));
// Shifting negative numbers left has undefined behavior, so use
// multiplication instead of direct shifting here.
EXPECT_EQ((intMinForLayoutUnit + 100) * (1 << kFractionBits),
- saturatedSet(intMinForLayoutUnit + 100, kFractionBits));
+ saturatedSet<kFractionBits>(intMinForLayoutUnit + 100));
}
TEST(SaturatedArithmeticTest, SetUnsigned)
@@ -141,18 +141,18 @@ TEST(SaturatedArithmeticTest, SetUnsigned)
const int kFractionBits = 6;
const int intMaxForLayoutUnit = INT_MAX >> kFractionBits;
- EXPECT_EQ(0, saturatedSet((unsigned)0, kFractionBits));
+ EXPECT_EQ(0, saturatedSet<kFractionBits>((unsigned)0));
EXPECT_EQ(getMaxSaturatedSetResultForTesting(kFractionBits),
- saturatedSet((unsigned)intMaxForLayoutUnit, kFractionBits));
+ saturatedSet<kFractionBits>((unsigned)intMaxForLayoutUnit));
const unsigned kOverflowed = intMaxForLayoutUnit + 100;
EXPECT_EQ(getMaxSaturatedSetResultForTesting(kFractionBits),
- saturatedSet(kOverflowed, kFractionBits));
+ saturatedSet<kFractionBits>(kOverflowed));
const unsigned kNotOverflowed = intMaxForLayoutUnit - 100;
EXPECT_EQ((intMaxForLayoutUnit - 100) << kFractionBits,
- saturatedSet(kNotOverflowed, kFractionBits));
+ saturatedSet<kFractionBits>(kNotOverflowed));
}
} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/wtf/SaturatedArithmetic.h ('k') | third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698