From fae99907dad86766c28062ff4f50ffd4710d2fdb Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 18 Dec 2019 23:10:51 +0000 Subject: [PATCH] [util] Add get to bitset --- src/util/util_bit.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/util/util_bit.h b/src/util/util_bit.h index d2f57995..981981fb 100644 --- a/src/util/util_bit.h +++ b/src/util/util_bit.h @@ -176,6 +176,19 @@ namespace dxvk::bit { } + constexpr bool get(uint32_t idx) const { + uint32_t dword = 0; + uint32_t bit = idx; + + // Compiler doesn't remove this otherwise. + if constexpr (Dwords > 1) { + dword = idx / 32; + bit = idx % 32; + } + + return m_dwords[dword] & (1u << bit); + } + constexpr void set(uint32_t idx, bool value) { uint32_t dword = 0; uint32_t bit = idx;