diff --git a/src/utils.h b/src/utils.h index 7e6a171ee..f09687ae9 100644 --- a/src/utils.h +++ b/src/utils.h @@ -80,7 +80,9 @@ template 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 inline T mid(T a, T b, T c) { return std::max(a, std::min(b, c)); } +template 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();