commit | 7885d3f5c6bc6190bd4784cf41d42330ab6f9d6e | [log] [tgz] |
---|---|---|
author | kwiberg <kwiberg@webrtc.org> | Tue Apr 25 19:35:07 2017 |
committer | Commit bot <commit-bot@chromium.org> | Tue Apr 25 19:35:07 2017 |
tree | c3a7c8758a6188e9c35593bd5851865030abbbba | |
parent | 192c348aaf36ddce908f74bcb2161f467c0d8fa1 [diff] |
Add SafeMin() and SafeMax(), which accept args of different types Specifically, they handle all combinations of two integer and two floating-point arguments by picking a result type that is guaranteed to be able to hold the result. This means callers no longer have to deal with potentially dangerous casting to make all the arguments have the same type, like they have to with std::min() and std::max(). Also, they're constexpr. Mostly for illustrative purposes, this CL replaces a few std::min() and std::max() calls with SafeMin() and SafeMax(). BUG=webrtc:7459 Review-Url: https://codereview.webrtc.org/2810483002 Cr-Commit-Position: refs/heads/master@{#17869}
WebRTC is a free, open software project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.
Our mission: To enable rich, high-quality RTC applications to be developed for the browser, mobile platforms, and IoT devices, and allow them all to communicate via a common set of protocols.
The WebRTC initiative is a project supported by Google, Mozilla and Opera, amongst others.
See http://www.webrtc.org/native-code/development for instructions on how to get started developing with the native code.