0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd::util: Add minmax().

This commit is contained in:
Jason Volk 2019-07-11 18:35:34 -07:00
parent e0ff0dfd3c
commit 59467cf670

View file

@ -244,5 +244,16 @@ is_powerof2(const long long v)
return v && !(v & (v - 1LL));
}
template<class T>
T
minmax(T ret,
const T &min,
const T &max)
{
ret = std::max(ret, min);
ret = std::min(ret, max);
return ret;
}
} // namespace util
} // namespace ircd