Add variadic convenience functions for base/numerics |
||
Issue descriptionThese would just perform the standard operations and return a CheckedNumeric as a result. So, something like: auto result = CheckedAdd(x, 3, CheckedSub(y, 2), CheckedMul(z, 12));
,
Nov 24 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4fcd6fa432b464f64de96c9bb03593b131a07029 commit 4fcd6fa432b464f64de96c9bb03593b131a07029 Author: jschuh <jschuh@chromium.org> Date: Thu Nov 24 11:58:39 2016 Add variadic helper functions for CheckedNumeric math operations This introduces variadic template functions that accept two or more arithmetic or CheckedNumeric arguments and return a CheckedNumeric. The functions are: * base::CheckAdd() - addition * base::CheckSub() - subtraction * base::CheckMul() - multiplication * base::CheckDiv() - division * base::CheckMod() - modulous * base::CheckLsh() - left integer shift * base::CheckRsh() - right integer shift BUG= 667097 NOTRY=true NOPRESUBMIT=true Review-Url: https://codereview.chromium.org/2522073004 Cr-Commit-Position: refs/heads/master@{#434311} [modify] https://crrev.com/4fcd6fa432b464f64de96c9bb03593b131a07029/base/numerics/safe_math.h [modify] https://crrev.com/4fcd6fa432b464f64de96c9bb03593b131a07029/base/numerics/safe_math_impl.h [modify] https://crrev.com/4fcd6fa432b464f64de96c9bb03593b131a07029/base/numerics/safe_numerics_unittest.cc
,
Jun 12 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by bugdroid1@chromium.org
, Nov 21 2016