summaryrefslogtreecommitdiff
path: root/third_party/base/numerics
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-30 15:42:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-30 15:42:00 +0000
commitdddfdad6ebb4e7172ff36f5a0db8a5cbf58d45f3 (patch)
tree2098bca3a3218c2480620a02f0e5ef479dad4653 /third_party/base/numerics
parent56569acb6daa4d487a3d3eccce5784028873651c (diff)
downloadpdfium-dddfdad6ebb4e7172ff36f5a0db8a5cbf58d45f3.tar.xz
Run clang-tidy modernize-use-auto on //third_party/pdfium
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md Bug: chromium:776257 Change-Id: I1f6637cde8b3e41825993a736bed6763dd7beacb Reviewed-on: https://pdfium-review.googlesource.com/19971 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'third_party/base/numerics')
-rw-r--r--third_party/base/numerics/safe_math_impl.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/third_party/base/numerics/safe_math_impl.h b/third_party/base/numerics/safe_math_impl.h
index 5ad79ce192..4bcc67188c 100644
--- a/third_party/base/numerics/safe_math_impl.h
+++ b/third_party/base/numerics/safe_math_impl.h
@@ -59,9 +59,9 @@ bool CheckedAddImpl(T x, T y, T* result) {
// it using the unsigned type of the same size.
using UnsignedDst = typename std::make_unsigned<T>::type;
using SignedDst = typename std::make_signed<T>::type;
- UnsignedDst ux = static_cast<UnsignedDst>(x);
- UnsignedDst uy = static_cast<UnsignedDst>(y);
- UnsignedDst uresult = static_cast<UnsignedDst>(ux + uy);
+ auto ux = static_cast<UnsignedDst>(x);
+ auto uy = static_cast<UnsignedDst>(y);
+ auto uresult = static_cast<UnsignedDst>(ux + uy);
*result = static_cast<T>(uresult);
// Addition is valid if the sign of (x + y) is equal to either that of x or
// that of y.
@@ -110,9 +110,9 @@ bool CheckedSubImpl(T x, T y, T* result) {
// it using the unsigned type of the same size.
using UnsignedDst = typename std::make_unsigned<T>::type;
using SignedDst = typename std::make_signed<T>::type;
- UnsignedDst ux = static_cast<UnsignedDst>(x);
- UnsignedDst uy = static_cast<UnsignedDst>(y);
- UnsignedDst uresult = static_cast<UnsignedDst>(ux - uy);
+ auto ux = static_cast<UnsignedDst>(x);
+ auto uy = static_cast<UnsignedDst>(y);
+ auto uresult = static_cast<UnsignedDst>(ux - uy);
*result = static_cast<T>(uresult);
// Subtraction is valid if either x and y have same sign, or (x-y) and x have
// the same sign.
@@ -163,7 +163,7 @@ bool CheckedMulImpl(T x, T y, T* result) {
using SignedDst = typename std::make_signed<T>::type;
const UnsignedDst ux = SafeUnsignedAbs(x);
const UnsignedDst uy = SafeUnsignedAbs(y);
- UnsignedDst uresult = static_cast<UnsignedDst>(ux * uy);
+ auto uresult = static_cast<UnsignedDst>(ux * uy);
const bool is_negative =
std::is_signed<T>::value && static_cast<SignedDst>(x ^ y) < 0;
*result = is_negative ? 0 - uresult : uresult;
@@ -308,7 +308,7 @@ struct CheckedLshOp<T,
static bool Do(T x, U shift, V* result) {
using ShiftType = typename std::make_unsigned<T>::type;
static const ShiftType kBitWidth = IntegerBitsPlusSign<T>::value;
- const ShiftType real_shift = static_cast<ShiftType>(shift);
+ const auto real_shift = static_cast<ShiftType>(shift);
// Signed shift is not legal on negative values.
if (!IsValueNegative(x) && real_shift < kBitWidth) {
// Just use a multiplication because it's easy.