kwiberg
7885d3f5c6
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}
2017-04-25 19:35:07 +00:00
..
2017-04-24 13:56:57 +00:00
2017-04-10 12:15:48 +00:00
2017-03-28 17:18:58 +00:00
2017-04-24 16:14:32 +00:00
2017-03-03 14:16:28 +00:00
2017-03-03 14:16:28 +00:00
2017-04-06 17:03:21 +00:00
2016-09-29 00:42:08 +00:00
2016-05-10 17:56:10 +00:00
2016-09-29 00:42:08 +00:00
2017-02-15 10:53:05 +00:00
2017-02-22 11:45:40 +00:00
2016-09-29 00:42:08 +00:00
2017-03-01 11:06:50 +00:00
2016-02-14 17:28:39 +00:00
2016-09-29 00:42:08 +00:00
2016-10-01 05:29:53 +00:00
2017-02-10 16:15:44 +00:00
2016-10-24 15:25:33 +00:00
2016-05-02 08:50:34 +00:00
2016-05-02 08:50:34 +00:00
2016-10-18 11:06:19 +00:00
2016-10-18 11:06:19 +00:00
2016-10-18 11:06:19 +00:00
2016-10-18 11:06:19 +00:00
2017-04-10 12:15:48 +00:00
2017-04-05 12:00:33 +00:00
2016-10-18 11:06:19 +00:00
2017-04-10 12:15:48 +00:00
2017-03-27 14:15:49 +00:00
2017-03-27 14:15:49 +00:00
2016-10-01 05:29:53 +00:00
2017-04-05 12:00:33 +00:00
2016-10-13 10:35:58 +00:00
2016-09-29 00:42:08 +00:00
2016-11-28 23:21:51 +00:00
2016-05-01 21:53:55 +00:00
2016-10-01 05:29:53 +00:00
2016-05-10 17:56:10 +00:00
2016-05-10 17:56:10 +00:00
2016-10-11 11:35:40 +00:00
2016-10-11 11:35:40 +00:00
2016-10-11 11:35:40 +00:00
2016-11-28 23:59:03 +00:00
2016-10-11 11:35:40 +00:00
2016-10-01 05:29:53 +00:00
2017-03-02 02:52:48 +00:00
2016-05-10 12:54:43 +00:00
2016-10-01 05:29:53 +00:00
2017-04-25 19:35:07 +00:00
2016-05-02 11:46:19 +00:00
2016-10-01 05:29:53 +00:00
2017-04-05 12:00:33 +00:00
2016-06-08 13:43:49 +00:00
2017-03-03 14:16:28 +00:00
2017-03-03 14:16:28 +00:00
2017-04-24 16:14:32 +00:00
2017-04-24 16:14:32 +00:00
2017-04-24 13:56:57 +00:00
2017-04-24 13:56:57 +00:00
2017-04-24 16:14:32 +00:00
2017-04-24 16:14:32 +00:00
2017-04-24 16:14:32 +00:00
2015-12-16 15:36:10 +00:00
2017-01-06 17:49:47 +00:00
2016-10-01 05:29:53 +00:00
2017-04-24 07:22:05 +00:00
2017-04-10 09:22:46 +00:00
2017-02-10 16:15:44 +00:00
2017-02-27 03:53:40 +00:00
2016-10-24 15:25:33 +00:00
2016-10-24 15:25:33 +00:00
2017-02-10 16:15:44 +00:00
2016-09-29 00:42:08 +00:00
2017-02-10 16:15:44 +00:00
2016-09-29 00:42:08 +00:00
2017-04-10 12:15:48 +00:00
2017-03-02 02:52:48 +00:00
2016-09-22 09:07:03 +00:00
2016-10-31 15:59:34 +00:00
2016-10-31 15:59:34 +00:00
2017-03-02 02:52:48 +00:00
2016-09-29 00:42:08 +00:00
2016-03-29 23:42:12 +00:00
2016-04-06 08:03:07 +00:00
2016-09-29 00:42:08 +00:00
2016-04-22 20:21:49 +00:00
2016-04-22 20:21:49 +00:00
2016-10-01 05:29:53 +00:00
2017-03-02 02:52:48 +00:00
2017-02-10 16:15:44 +00:00
2017-04-05 12:00:33 +00:00