1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-09 13:46:08 +01:00
dxvk/src/util/util_math.h
2019-12-11 03:18:39 +01:00

19 lines
338 B
C++

#pragma once
namespace dxvk {
constexpr size_t CACHE_LINE_SIZE = 64;
template<typename T>
constexpr T clamp(T n, T lo, T hi) {
if (n < lo) return lo;
if (n > hi) return hi;
return n;
}
template<typename T, typename U = T>
constexpr T align(T what, U to) {
return (what + to - 1) & ~(to - 1);
}
}