[ox/std] Add ox::clamp
This commit is contained in:
parent
1aebe93c52
commit
78942ce21d
6
deps/ox/src/ox/std/math.hpp
vendored
6
deps/ox/src/ox/std/math.hpp
vendored
@ -24,6 +24,12 @@ constexpr const T &max(const T &a, const T &b) noexcept {
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
constexpr const T &clamp(const T &v, const T &lo, const T &hi) noexcept {
|
||||
return min(ox::max(v, lo), hi);
|
||||
}
|
||||
|
||||
template<typename I>
|
||||
[[nodiscard]]
|
||||
constexpr I pow(I v, int e) noexcept {
|
||||
|
Loading…
Reference in New Issue
Block a user