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

Unified Diff: base/numerics/safe_math.h

Issue 2529413002: Loosen restrictions on CheckedNumeric bitwise operators (Closed)
Patch Set: more tests 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 a4ae633049d2b64cf7ecc7c21dcf3d0b973c025f..78b88326c44bdf697091f4ea74232b71a434788a 100644
--- a/base/numerics/safe_math.h
+++ b/base/numerics/safe_math.h
@@ -19,7 +19,9 @@ namespace internal {
// boundary conditions such as overflow, underflow, and invalid conversions.
// The CheckedNumeric type implicitly converts from floating point and integer
// data types, and contains overloads for basic arithmetic operations (i.e.: +,
-// -, *, / for all types, % for integers, and &, |, ^ for unsigned integers).
+// -, *, / for all types and %, <<, >>, &, |, ^ for integers; additionally the
+// result of all bitwise logical operations is always promoted to an unsigned
+// CheckedNumeric type matching the width of the larger operand).
//
// You may also use one of the variadic convenience functions, which accept
// standard arithmetic or CheckedNumeric types, perform arithmetic operations,
« 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