Skip to content
Extraits de code Groupes Projets
Valider ec407bbd rédigé par Thomas Goyne's avatar Thomas Goyne
Parcourir les fichiers

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

VC++'s optimizer completely falls down on it for whatever reason.
parent 24b8db52
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -80,7 +80,9 @@ template <typename T> T tabs(T x) { return x < 0 ? -x : x; } ...@@ -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]) /// Get the middle value of a, b, and c (i.e. clamp b to [a,c])
/// @precondition 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 /// Get the text contents of the clipboard, or empty string on failure
std::string GetClipboard(); std::string GetClipboard();
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter