Revert BitArray changes

This commit is contained in:
Mateusz Karbowiak
2024-10-31 01:06:04 +01:00
parent 5d32ed7f8e
commit 2ae3932fcc

View File

@@ -214,8 +214,8 @@ public:
{
ASSERT(index >= 0 && index < _count);
const ItemType offset = index / sizeof(ItemType);
const ItemType bitMask = static_cast<ItemType>((int32)(1 << (index & (static_cast<int32>(sizeof(ItemType)) - 1))));
const ItemType item = static_cast<const ItemType*>(_allocation.Get())[offset];
const ItemType bitMask = (ItemType)(int32)(1 << (index & ((int32)sizeof(ItemType) - 1)));
const ItemType item = ((ItemType*)_allocation.Get())[offset];
return (item & bitMask) != 0;
}
@@ -228,12 +228,12 @@ public:
{
ASSERT(index >= 0 && index < _count);
const ItemType offset = index / sizeof(ItemType);
const ItemType bitMask = static_cast<ItemType>((int32)(1 << (index & (static_cast<int32>(sizeof(ItemType)) - 1))));
ItemType& item = reinterpret_cast<ItemType&>(_allocation.Get())[offset];
const ItemType bitMask = (ItemType)(int32)(1 << (index & ((int32)sizeof(ItemType) - 1)));
ItemType& item = ((ItemType*)_allocation.Get())[offset];
if (value)
item |= bitMask;
else
item &= ~bitMask;
item &= ~bitMask; // Clear the bit
}
public: