Skip to content

Commit eb6010c

Browse files
committed
Fix BitArray again
1 parent 5a23060 commit eb6010c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

Source/Engine/Core/Collections/BitArray.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ API_CLASS(InBuild) class BitArray
1616
public:
1717
using ItemType = uint64;
1818
using AllocationData = typename AllocationType::template Data<ItemType>;
19-
static constexpr int32 ItemBitCount = 64;
2019

2120
private:
2221
int32 _count;
@@ -210,8 +209,8 @@ API_CLASS(InBuild) class BitArray
210209
bool Get(const int32 index) const
211210
{
212211
ASSERT(index >= 0 && index < _count);
213-
const ItemType offset = index / ItemBitCount;
214-
const ItemType bitMask = (ItemType)(1 << (index & (ItemBitCount - 1)));
212+
const ItemType offset = index / 64;
213+
const ItemType bitMask = 1ull << (index & 63ull);
215214
const ItemType item = ((ItemType*)_allocation.Get())[offset];
216215
return (item & bitMask) != 0;
217216
}
@@ -224,8 +223,8 @@ API_CLASS(InBuild) class BitArray
224223
void Set(const int32 index, const bool value)
225224
{
226225
ASSERT(index >= 0 && index < _count);
227-
const ItemType offset = index / ItemBitCount;
228-
const ItemType bitMask = (ItemType)(1 << (index & (ItemBitCount - 1)));
226+
const ItemType offset = index / 64;
227+
const ItemType bitMask = 1ull << (index & 63ull);
229228
ItemType& item = ((ItemType*)_allocation.Get())[offset];
230229
if (value)
231230
item |= bitMask; // Set the bit

0 commit comments

Comments
 (0)