mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 09:00:17 +02:00
Common/BitSet: Mark getters as const
These don't modify internal state.
This commit is contained in:
1 parent
88ee56f471
commit
f5d2e0db29
1 file changed
+10
-5
@@ -33,7 +33,8 @@ struct BitSet final {
|
||||
FEXCore::Allocator::free(Memory);
|
||||
Memory = nullptr;
|
||||
}
|
||||
bool Get(T Element) {
|
||||
[[nodiscard]]
|
||||
bool Get(T Element) const {
|
||||
return (Memory[Element / MinimumSizeBits] & (1ULL << (Element % MinimumSizeBits))) != 0;
|
||||
}
|
||||
void Set(T Element) {
|
||||
@@ -48,13 +49,15 @@ struct BitSet final {
|
||||
void MemSet(size_t Elements) {
|
||||
memset(Memory, 0xFF, ToBytes(Elements));
|
||||
}
|
||||
uint32_t ToBytes(size_t Elements) {
|
||||
[[nodiscard]]
|
||||
uint32_t ToBytes(size_t Elements) const {
|
||||
return AlignUp(Elements, MinimumSizeBits) / MinimumSize;
|
||||
}
|
||||
|
||||
// This very explicitly doesn't let you take an address
|
||||
// Is only a getter
|
||||
bool operator[](T Element) {
|
||||
[[nodiscard]]
|
||||
bool operator[](T Element) const {
|
||||
return Get(Element);
|
||||
}
|
||||
};
|
||||
@@ -72,7 +75,8 @@ struct BitSetView final {
|
||||
Memory = &Set.Memory[ElementOffset / MinimumSizeBits];
|
||||
}
|
||||
|
||||
bool Get(T Element) {
|
||||
[[nodiscard]]
|
||||
bool Get(T Element) const {
|
||||
return (Memory[Element / MinimumSizeBits] & (1ULL << (Element % MinimumSizeBits))) != 0;
|
||||
}
|
||||
void Set(T Element) {
|
||||
@@ -90,7 +94,8 @@ struct BitSetView final {
|
||||
|
||||
// This very explicitly doesn't let you take an address
|
||||
// Is only a getter
|
||||
bool operator[](T Element) {
|
||||
[[nodiscard]]
|
||||
bool operator[](T Element) const {
|
||||
return Get(Element);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user