1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 10:24:10 +01:00

[util] Add alignDown helper

This commit is contained in:
Joshua Ashton 2019-09-15 02:59:26 +01:00 committed by Philip Rebohle
parent 57b2c02528
commit 16dd1249b7

View File

@ -18,6 +18,11 @@ namespace dxvk {
return (what + to - 1) & ~(to - 1);
}
template<typename T, typename U = T>
constexpr T alignDown(T what, U to) {
return (what / to) * to;
}
// Equivalent of std::clamp for use with floating point numbers
// Handles (-){INFINITY,NAN} cases.
// Will return min in cases of NAN, etc.