1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[util] Add get to bitset

This commit is contained in:
Joshua Ashton 2019-12-18 23:10:51 +00:00
parent 5cc0fd5c25
commit fae99907da

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;