From eb6010cba74286c52f3eb255fc13f67bf82b8271 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 16 Jun 2025 23:20:20 +0200 Subject: [PATCH] Fix `BitArray` again --- Source/Engine/Core/Collections/BitArray.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Engine/Core/Collections/BitArray.h b/Source/Engine/Core/Collections/BitArray.h index 6589fa9a1..28a71351b 100644 --- a/Source/Engine/Core/Collections/BitArray.h +++ b/Source/Engine/Core/Collections/BitArray.h @@ -16,7 +16,6 @@ API_CLASS(InBuild) class BitArray public: using ItemType = uint64; using AllocationData = typename AllocationType::template Data; - static constexpr int32 ItemBitCount = 64; private: int32 _count; @@ -210,8 +209,8 @@ public: bool Get(const int32 index) const { ASSERT(index >= 0 && index < _count); - const ItemType offset = index / ItemBitCount; - const ItemType bitMask = (ItemType)(1 << (index & (ItemBitCount - 1))); + const ItemType offset = index / 64; + const ItemType bitMask = 1ull << (index & 63ull); const ItemType item = ((ItemType*)_allocation.Get())[offset]; return (item & bitMask) != 0; } @@ -224,8 +223,8 @@ public: void Set(const int32 index, const bool value) { ASSERT(index >= 0 && index < _count); - const ItemType offset = index / ItemBitCount; - const ItemType bitMask = (ItemType)(1 << (index & (ItemBitCount - 1))); + const ItemType offset = index / 64; + const ItemType bitMask = 1ull << (index & 63ull); ItemType& item = ((ItemType*)_allocation.Get())[offset]; if (value) item |= bitMask; // Set the bit