diff --git a/Source/Engine/Core/Collections/ChunkedArray.h b/Source/Engine/Core/Collections/ChunkedArray.h index 38bf92fb8..86aa9acd9 100644 --- a/Source/Engine/Core/Collections/ChunkedArray.h +++ b/Source/Engine/Core/Collections/ChunkedArray.h @@ -133,18 +133,16 @@ public: return _chunkIndex * ChunkSize + _index; } - public: - bool IsEnd() const + FORCE_INLINE bool IsEnd() const { - return Index() == _collection->Count(); + return (_chunkIndex * ChunkSize + _index) == _collection->_count; } - bool IsNotEnd() const + FORCE_INLINE bool IsNotEnd() const { - return Index() != _collection->Count(); + return (_chunkIndex * ChunkSize + _index) != _collection->_count; } - public: FORCE_INLINE T& operator*() const { return _collection->_chunks[_chunkIndex]->At(_index); @@ -155,7 +153,6 @@ public: return &_collection->_chunks[_chunkIndex]->At(_index); } - public: FORCE_INLINE bool operator==(const Iterator& v) const { return _collection == v._collection && _chunkIndex == v._chunkIndex && _index == v._index; @@ -166,7 +163,6 @@ public: return _collection != v._collection || _chunkIndex != v._chunkIndex || _index != v._index; } - public: Iterator& operator++() { // Check if it is not at end diff --git a/Source/Engine/Foliage/Foliage.cpp b/Source/Engine/Foliage/Foliage.cpp index 82765f151..898139ce7 100644 --- a/Source/Engine/Foliage/Foliage.cpp +++ b/Source/Engine/Foliage/Foliage.cpp @@ -634,15 +634,12 @@ void Foliage::RemoveFoliageType(int32 index) int32 Foliage::GetFoliageTypeInstancesCount(int32 index) const { PROFILE_CPU(); - int32 result = 0; - - for (auto i = Instances.Begin(); i.IsNotEnd(); i++) + for (auto i = Instances.Begin(); i.IsNotEnd(); ++i) { if (i->Type == index) result++; } - return result; }