mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-07 15:46:01 +00:00
common: slot_vector: added is_allocated
to check if the slot already exists
This commit is contained in:
parent
7ad9d4a0d3
commit
84f4489573
|
@ -54,6 +54,10 @@ public:
|
|||
return values[id.index].object;
|
||||
}
|
||||
|
||||
bool is_allocated(SlotId id) const {
|
||||
return ReadStorageBit(id.index);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
[[nodiscard]] SlotId insert(Args&&... args) noexcept {
|
||||
const u32 index = FreeValueIndex();
|
||||
|
@ -107,7 +111,7 @@ private:
|
|||
stored_bitset[index / 64] &= ~(u64(1) << (index % 64));
|
||||
}
|
||||
|
||||
bool ReadStorageBit(u32 index) noexcept {
|
||||
bool ReadStorageBit(u32 index) const noexcept {
|
||||
return ((stored_bitset[index / 64] >> (index % 64)) & 1) != 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue