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

Unified Diff: third_party/WebKit/Source/wtf/SaturatedArithmetic.h

Issue 2171813002: Better performance for -LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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/SaturatedArithmetic.h
diff --git a/third_party/WebKit/Source/wtf/SaturatedArithmetic.h b/third_party/WebKit/Source/wtf/SaturatedArithmetic.h
index a627b532ddc9e310b6210422ed4bd847cec7a7dd..eec1c9b3606eaaa5a2956aedcc2788c543e87437 100644
--- a/third_party/WebKit/Source/wtf/SaturatedArithmetic.h
+++ b/third_party/WebKit/Source/wtf/SaturatedArithmetic.h
@@ -73,6 +73,13 @@ ALWAYS_INLINE int32_t saturatedSubtraction(int32_t a, int32_t b)
return result;
}
+ALWAYS_INLINE int32_t saturatedNegative(int32_t a)
+{
+ if (UNLIKELY(a == std::numeric_limits<int>::min()))
+ return std::numeric_limits<int>::max();
+ return -a;
+}
+
inline int getMaxSaturatedSetResultForTesting(int FractionalShift)
{
// For C version the set function maxes out to max int, this differs from
« no previous file with comments | « third_party/WebKit/Source/platform/LayoutUnit.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