| Index: base/numerics/safe_math.h
|
| diff --git a/base/numerics/safe_math.h b/base/numerics/safe_math.h
|
| index 1fab032af0f449d825282b1c90307f231837985f..8fc88b464fc9be50b74460547d6a761525a8dca4 100644
|
| --- a/base/numerics/safe_math.h
|
| +++ b/base/numerics/safe_math.h
|
| @@ -145,6 +145,14 @@ class CheckedNumeric {
|
| return CheckedNumeric<T>(value, validity);
|
| }
|
|
|
| + // This function is available only for integral types. It returns an unsigned
|
| + // integer of the same width as the source type, containing the absolute value
|
| + // of the source, and properly handling signed min.
|
| + CheckedNumeric<typename UnsignedOrFloatForSize<T>::type> UnsignedAbs() const {
|
| + return CheckedNumeric<typename UnsignedOrFloatForSize<T>::type>(
|
| + CheckedUnsignedAbs(state_.value()), state_.validity());
|
| + }
|
| +
|
| CheckedNumeric& operator++() {
|
| *this += 1;
|
| return *this;
|
|
|