diff options
| author | 2021-02-08 18:01:19 -0800 | |
|---|---|---|
| committer | 2021-02-18 16:16:24 -0800 | |
| commit | b5b92fd1e5f44634ccccc8e0526cd725dfd81f34 (patch) | |
| tree | fd4550e43ec570ab9dc0988fd0be5f5add27886e /src | |
| parent | hle: kernel: Rename SharedMemory to KSharedMemory. (diff) | |
| download | yuzu-b5b92fd1e5f44634ccccc8e0526cd725dfd81f34.tar.gz yuzu-b5b92fd1e5f44634ccccc8e0526cd725dfd81f34.tar.xz yuzu-b5b92fd1e5f44634ccccc8e0526cd725dfd81f34.zip | |
common: alignment: Add DivideUp utility method.
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/alignment.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index fb81f10d8..32d796ffa 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h | |||
| @@ -42,6 +42,11 @@ requires std::is_integral_v<T>[[nodiscard]] constexpr bool IsAligned(T value, si | |||
| 42 | return (value & mask) == 0; | 42 | return (value & mask) == 0; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | template <typename T, typename U> | ||
| 46 | requires std::is_integral_v<T>[[nodiscard]] constexpr T DivideUp(T x, U y) { | ||
| 47 | return (x + (y - 1)) / y; | ||
| 48 | } | ||
| 49 | |||
| 45 | template <typename T, size_t Align = 16> | 50 | template <typename T, size_t Align = 16> |
| 46 | class AlignmentAllocator { | 51 | class AlignmentAllocator { |
| 47 | public: | 52 | public: |