diff options
| author | 2021-11-20 14:46:19 +0100 | |
|---|---|---|
| committer | 2021-11-20 14:46:19 +0100 | |
| commit | da2fe8190518d3266df7f4a48f9b651eaea84d4b (patch) | |
| tree | d584caaa250a596a3cbd3cd9d7e3767c13f46663 /src/common/bit_util.h | |
| parent | TextureCache: Assure full conversions on depth/stencil write shaders. (diff) | |
| download | yuzu-da2fe8190518d3266df7f4a48f9b651eaea84d4b.tar.gz yuzu-da2fe8190518d3266df7f4a48f9b651eaea84d4b.tar.xz yuzu-da2fe8190518d3266df7f4a48f9b651eaea84d4b.zip | |
TextureCache: Refactor and fix linux compiling.
Diffstat (limited to '')
| -rw-r--r-- | src/common/bit_util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/bit_util.h b/src/common/bit_util.h index 64520ca4e..eef8c1c5a 100644 --- a/src/common/bit_util.h +++ b/src/common/bit_util.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <bit> | 7 | #include <bit> |
| 8 | #include <climits> | 8 | #include <climits> |
| 9 | #include <cstddef> | 9 | #include <cstddef> |
| 10 | #include <type_traits> | ||
| 10 | 11 | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 12 | 13 | ||
| @@ -44,4 +45,10 @@ template <typename T> | |||
| 44 | return static_cast<u32>(log2_f + static_cast<u64>((value ^ (1ULL << log2_f)) != 0ULL)); | 45 | return static_cast<u32>(log2_f + static_cast<u64>((value ^ (1ULL << log2_f)) != 0ULL)); |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 48 | template <typename T> | ||
| 49 | requires std::is_integral_v<T> | ||
| 50 | [[nodiscard]] T NextPow2(T value) { | ||
| 51 | return static_cast<T>(1ULL << ((8U * sizeof(T)) - std::countl_zero(value - 1U))); | ||
| 52 | } | ||
| 53 | |||
| 47 | } // namespace Common | 54 | } // namespace Common |