0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01: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)); 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 util
} // namespace ircd } // namespace ircd