1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-08 10:46:09 +01:00
dxvk/src/util/util_math.h

19 lines
338 B
C
Raw Normal View History

2017-10-10 23:32:13 +02:00
#pragma once
namespace dxvk {
constexpr size_t CACHE_LINE_SIZE = 64;
2017-10-10 23:32:13 +02:00
template<typename T>
2019-03-24 21:38:39 +01:00
constexpr T clamp(T n, T lo, T hi) {
2017-10-10 23:32:13 +02:00
if (n < lo) return lo;
if (n > hi) return hi;
return n;
}
template<typename T, typename U = T>
2019-03-24 21:38:39 +01:00
constexpr T align(T what, U to) {
return (what + to - 1) & ~(to - 1);
}
2017-10-10 23:32:13 +02:00
}