diff options
author | Wunkolo <Wunkolo@gmail.com> | 2022-02-23 19:08:32 +0100 |
---|---|---|
committer | Wunkolo <Wunkolo@gmail.com> | 2022-03-09 22:57:47 +0100 |
commit | add2cfcb96d75cd16f7b0bf554bb30d97e720111 (patch) | |
tree | b22ac59aba9c26fae3e4dfbd0aa031efbeb3e493 | |
parent | Merge pull request #7975 from bunnei/ldr-fix (diff) | |
download | yuzu-add2cfcb96d75cd16f7b0bf554bb30d97e720111.tar yuzu-add2cfcb96d75cd16f7b0bf554bb30d97e720111.tar.gz yuzu-add2cfcb96d75cd16f7b0bf554bb30d97e720111.tar.bz2 yuzu-add2cfcb96d75cd16f7b0bf554bb30d97e720111.tar.lz yuzu-add2cfcb96d75cd16f7b0bf554bb30d97e720111.tar.xz yuzu-add2cfcb96d75cd16f7b0bf554bb30d97e720111.tar.zst yuzu-add2cfcb96d75cd16f7b0bf554bb30d97e720111.zip |
-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 f50d3308a..f37538e06 100644 --- a/src/common/bit_util.h +++ b/src/common/bit_util.h @@ -57,4 +57,11 @@ requires std::is_integral_v<T> return static_cast<T>(1ULL << ((8U * sizeof(T)) - std::countl_zero(value - 1U))); } +template <size_t bit_index, typename T> +requires std::is_integral_v<T> +[[nodiscard]] constexpr bool Bit(const T value) { + static_assert(bit_index < BitSize<T>(), "bit_index must be smaller than size of T"); + return ((value >> bit_index) & T(1)) == T(1); +} + } // namespace Common |