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

Unified Diff: base/numerics/saturated_arithmetic.h

Issue 2744423002: Handle large rects better. (Closed)
Patch Set: Add comment and change constant reference. Created 3 years, 9 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
« no previous file with comments | « no previous file | base/numerics/saturated_arithmetic_arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/numerics/saturated_arithmetic.h
diff --git a/base/numerics/saturated_arithmetic.h b/base/numerics/saturated_arithmetic.h
index 7e24fe3617b127fe6641574271f55d3dbafd5f06..74fbba808d63ad849c6a64a44eef284042bd8ec0 100644
--- a/base/numerics/saturated_arithmetic.h
+++ b/base/numerics/saturated_arithmetic.h
@@ -56,6 +56,12 @@ ALWAYS_INLINE int32_t SaturatedNegative(int32_t a) {
return -a;
}
+ALWAYS_INLINE int32_t SaturatedAbsolute(int32_t a) {
+ if (a >= 0)
+ return a;
+ return SaturatedNegative(a);
+}
+
ALWAYS_INLINE int GetMaxSaturatedSetResultForTesting(int fractional_shift) {
// For C version the set function maxes out to max int, this differs from
// the ARM asm version, see saturated_arithmetic_arm.h for the equivalent asm
« no previous file with comments | « no previous file | base/numerics/saturated_arithmetic_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698