| Index: webrtc/base/safe_conversions.h
|
| diff --git a/webrtc/base/safe_conversions.h b/webrtc/base/safe_conversions.h
|
| index 51239bc65dd33ceec4bf68ce7ce8d662dbaa13c9..ff9cc44bc2c183ecb831acdc01fbc2ef1e7f4d66 100644
|
| --- a/webrtc/base/safe_conversions.h
|
| +++ b/webrtc/base/safe_conversions.h
|
| @@ -27,14 +27,20 @@ inline bool IsValueInRangeForNumericType(Src value) {
|
| return internal::RangeCheck<Dst>(value) == internal::TYPE_VALID;
|
| }
|
|
|
| -// checked_cast<> is analogous to static_cast<> for numeric types,
|
| -// except that it CHECKs that the specified numeric conversion will not
|
| -// overflow or underflow. NaN source will always trigger a CHECK.
|
| +// checked_cast<> and dchecked_cast<> are analogous to static_cast<> for
|
| +// numeric types, except that they [D]CHECK that the specified numeric
|
| +// conversion will not overflow or underflow. NaN source will always trigger
|
| +// the [D]CHECK.
|
| template <typename Dst, typename Src>
|
| inline Dst checked_cast(Src value) {
|
| RTC_CHECK(IsValueInRangeForNumericType<Dst>(value));
|
| return static_cast<Dst>(value);
|
| }
|
| +template <typename Dst, typename Src>
|
| +inline Dst dchecked_cast(Src value) {
|
| + RTC_DCHECK(IsValueInRangeForNumericType<Dst>(value));
|
| + return static_cast<Dst>(value);
|
| +}
|
|
|
| // saturated_cast<> is analogous to static_cast<> for numeric types, except
|
| // that the specified numeric conversion will saturate rather than overflow or
|
|
|