Don't use std::min/max in mid()

VC++'s optimizer completely falls down on it for whatever reason.
This commit is contained in:
Thomas Goyne 2014-07-16 12:19:12 -07:00
parent 24b8db522a
commit ec407bbd7f

View file

@ -80,7 +80,9 @@ template <typename T> T tabs(T x) { return x < 0 ? -x : x; }
/// Get the middle value of a, b, and c (i.e. clamp b to [a,c])
/// @precondition a <= c
template<typename T> inline T mid(T a, T b, T c) { return std::max(a, std::min(b, c)); }
template<typename T> inline T mid(T a, T b, T c) {
return a > b ? a : (b > c ? c : b);
}
/// Get the text contents of the clipboard, or empty string on failure
std::string GetClipboard();