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

Unified Diff: base/numerics/safe_math.h

Issue 2510973002: Add support for CheckedNumeric bitshift operators (Closed)
Patch Set: format Created 4 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
« no previous file with comments | « no previous file | base/numerics/safe_math_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/numerics/safe_math.h
diff --git a/base/numerics/safe_math.h b/base/numerics/safe_math.h
index 41aa0515c1dfb17b2feccf28cff379965d720e18..74cc36ba567f7b20293e15026f2f5c8dc1d82f08 100644
--- a/base/numerics/safe_math.h
+++ b/base/numerics/safe_math.h
@@ -117,6 +117,10 @@ class CheckedNumeric {
template <typename Src> CheckedNumeric& operator*=(Src rhs);
template <typename Src> CheckedNumeric& operator/=(Src rhs);
template <typename Src> CheckedNumeric& operator%=(Src rhs);
+ template <typename Src>
Tom Sepez 2016/11/17 00:29:45 nit: format as above?
jschuh 2016/11/17 00:47:51 Done. Stupid git cl format.
+ CheckedNumeric& operator<<=(Src rhs);
+ template <typename Src>
+ CheckedNumeric& operator>>=(Src rhs);
CheckedNumeric operator-() const {
// Negation is always valid for floating point.
@@ -240,6 +244,8 @@ BASE_NUMERIC_ARITHMETIC_OPERATORS(Sub, -, -=, MAX_EXPONENT_PROMOTION)
BASE_NUMERIC_ARITHMETIC_OPERATORS(Mul, *, *=, MAX_EXPONENT_PROMOTION)
BASE_NUMERIC_ARITHMETIC_OPERATORS(Div, /, /=, MAX_EXPONENT_PROMOTION)
BASE_NUMERIC_ARITHMETIC_OPERATORS(Mod, %, %=, MAX_EXPONENT_PROMOTION)
+BASE_NUMERIC_ARITHMETIC_OPERATORS(LeftShift, <<, <<=, LEFT_PROMOTION)
+BASE_NUMERIC_ARITHMETIC_OPERATORS(RightShift, >>, >>=, LEFT_PROMOTION)
#undef BASE_NUMERIC_ARITHMETIC_OPERATORS
« no previous file with comments | « no previous file | base/numerics/safe_math_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698