mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
ircd::util: Add minmax().
This commit is contained in:
parent
e0ff0dfd3c
commit
59467cf670
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue