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

Unified Diff: base/numerics/safe_conversions.h

Issue 2566733002: Performance optimizations for base/numerics absolute value and multiply (Closed)
Patch Set: one more nit Created 4 years 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/safe_conversions_impl.h » ('j') | base/numerics/safe_math_impl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/numerics/safe_conversions.h
diff --git a/base/numerics/safe_conversions.h b/base/numerics/safe_conversions.h
index 6e04b467b9023ace2908ae0da0d6ae6969f6b814..51edac649c8ce59b59509041eec860e1ac2d499a 100644
--- a/base/numerics/safe_conversions.h
+++ b/base/numerics/safe_conversions.h
@@ -36,6 +36,9 @@ namespace base {
// IsValueNegative<>() - A convenience function that will accept any arithmetic
// type as an argument and will return whether the value is less than zero.
// Unsigned types always return false.
+// SafeUnsignedAbs() - Returns the absolute value of the supplied integer
+// parameter as an unsigned result (thus avoiding an overflow if the value
+// is the signed, two's complement minimum).
// StrictNumeric<> - A wrapper type that performs assignments and copies via
// the strict_cast<> template, and can perform valid arithmetic comparisons
// across any range of arithmetic types. StrictNumeric is the return type
@@ -279,6 +282,7 @@ STRICT_COMPARISON_OP(IsNotEqual, !=);
using internal::strict_cast;
using internal::saturated_cast;
+using internal::SafeUnsignedAbs;
using internal::StrictNumeric;
using internal::MakeStrictNum;
« no previous file with comments | « no previous file | base/numerics/safe_conversions_impl.h » ('j') | base/numerics/safe_math_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698