Chromium Code Reviews| Index: base/numerics/safe_math_impl.h |
| diff --git a/base/numerics/safe_math_impl.h b/base/numerics/safe_math_impl.h |
| index ae0a5b1d4f031d8228ee47172daf27153dd6ce77..f648d1642074f9071c66891e9bd2f4e8f7a7afb8 100644 |
| --- a/base/numerics/safe_math_impl.h |
| +++ b/base/numerics/safe_math_impl.h |
| @@ -47,8 +47,8 @@ struct UnsignedOrFloatForSize<Numeric, false, true> { |
| template <typename T> |
| constexpr bool HasSignBit(T x) { |
| // Cast to unsigned since right shift on signed is undefined. |
|
scottmg
2016/12/08 21:05:02
You're not casting to unsigned.
|
| - return !!(static_cast<typename std::make_unsigned<T>::type>(x) >> |
| - PositionOfSignBit<T>::value); |
| + return static_cast<typename std::make_signed<T>::type>(x) < |
| + static_cast<typename std::make_signed<T>::type>(0); |
| } |
| // This wrapper undoes the standard integer promotions. |