[util] Add get to bitset

This commit is contained in:
Joshua Ashton 2019-12-18 23:10:51 +00:00
parent 5cc0fd5c25
commit fae99907da
1 changed files with 13 additions and 0 deletions

View File

@ -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;