More robust against malformed hints
std::clamp can assert when the minimum value is bigger than the maximum value, max(min(minimum, value), maximum) should be a bit more robust against such cases, and still return a valuse that is somewhat sensible and usable
(cherry picked from commit 5deb0a74)
5deb0a74 More robust against malformed hints