diff --git a/Source/Engine/Core/Collections/BitArray.h b/Source/Engine/Core/Collections/BitArray.h index c7853b989..267885438 100644 --- a/Source/Engine/Core/Collections/BitArray.h +++ b/Source/Engine/Core/Collections/BitArray.h @@ -22,12 +22,12 @@ private: int32 _capacity; AllocationData _allocation; - FORCE_INLINE static int32 ToItemCount(int32 size) + FORCE_INLINE static int32 ToItemCount(const int32 size) { return Math::DivideAndRoundUp(size, sizeof(ItemType)); } - FORCE_INLINE static int32 ToItemCapacity(int32 size) + FORCE_INLINE static int32 ToItemCapacity(const int32 size) { return Math::Max(Math::DivideAndRoundUp(size, sizeof(ItemType)), 1); } @@ -46,7 +46,7 @@ public: /// Initializes a new instance of the class. /// /// The initial capacity. - BitArray(int32 capacity) + BitArray(const int32 capacity) : _count(0) , _capacity(capacity) { @@ -200,7 +200,7 @@ public: /// /// The index of the item. /// The value of the item. - FORCE_INLINE bool operator[](int32 index) const + FORCE_INLINE bool operator[](const int32 index) const { return Get(index); } @@ -210,7 +210,7 @@ public: /// /// The index of the item. /// The value of the item. - bool Get(int32 index) const + bool Get(const int32 index) const { ASSERT(index >= 0 && index < _count); const ItemType offset = index / sizeof(ItemType); @@ -224,7 +224,7 @@ public: /// /// The index of the item. /// The value to set. - void Set(int32 index, bool value) + void Set(const int32 index, const bool value) { ASSERT(index >= 0 && index < _count); const ItemType offset = index / sizeof(ItemType); @@ -250,7 +250,7 @@ public: /// /// The new capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void SetCapacity(const int32 capacity, bool preserveContents = true) + void SetCapacity(const int32 capacity, const bool preserveContents = true) { if (capacity == _capacity) return; @@ -266,7 +266,7 @@ public: /// /// The new collection size. /// True if preserve collection data when changing its size, otherwise collection after resize might not contain the previous data. - void Resize(int32 size, bool preserveContents = true) + void Resize(const int32 size, const bool preserveContents = true) { if (_count <= size) EnsureCapacity(size, preserveContents); @@ -278,7 +278,7 @@ public: /// /// The minimum capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void EnsureCapacity(int32 minCapacity, bool preserveContents = true) + void EnsureCapacity(int32 minCapacity, const bool preserveContents = true) { if (_capacity < minCapacity) { @@ -313,7 +313,7 @@ public: /// /// The items to add. /// The items count. - void Add(const bool* items, int32 count) + void Add(const bool* items, const int32 count) { EnsureCapacity(_count + count); for (int32 i = 0; i < count; i++) diff --git a/Source/Engine/Core/Collections/Dictionary.h b/Source/Engine/Core/Collections/Dictionary.h index 9e516dae7..1ce1db21b 100644 --- a/Source/Engine/Core/Collections/Dictionary.h +++ b/Source/Engine/Core/Collections/Dictionary.h @@ -149,7 +149,7 @@ public: /// Initializes a new instance of the class. /// /// The initial capacity. - Dictionary(int32 capacity) + Dictionary(const int32 capacity) { SetCapacity(capacity); } @@ -538,7 +538,7 @@ public: /// /// The new capacity. /// Enables preserving collection contents during resizing. - void SetCapacity(int32 capacity, bool preserveContents = true) + void SetCapacity(int32 capacity, const bool preserveContents = true) { if (capacity == Capacity()) return; @@ -598,7 +598,7 @@ public: /// /// The minimum required capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void EnsureCapacity(int32 minCapacity, bool preserveContents = true) + void EnsureCapacity(int32 minCapacity, const bool preserveContents = true) { if (_size >= minCapacity) return; diff --git a/Source/Engine/Core/Collections/HashSet.h b/Source/Engine/Core/Collections/HashSet.h index b53225044..1bfcc75eb 100644 --- a/Source/Engine/Core/Collections/HashSet.h +++ b/Source/Engine/Core/Collections/HashSet.h @@ -130,7 +130,7 @@ public: /// Initializes a new instance of the class. /// /// The initial capacity. - HashSet(int32 capacity) + HashSet(const int32 capacity) { SetCapacity(capacity); } @@ -415,7 +415,7 @@ public: /// /// New capacity /// Enable/disable preserving collection contents during resizing - void SetCapacity(int32 capacity, bool preserveContents = true) + void SetCapacity(int32 capacity, const bool preserveContents = true) { if (capacity == Capacity()) return; @@ -474,7 +474,7 @@ public: /// /// The minimum required capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void EnsureCapacity(int32 minCapacity, bool preserveContents = true) + void EnsureCapacity(int32 minCapacity, const bool preserveContents = true) { if (_size >= minCapacity) return; diff --git a/Source/Engine/Core/Collections/RingBuffer.h b/Source/Engine/Core/Collections/RingBuffer.h index 4dcc75e33..1bc0ae5f4 100644 --- a/Source/Engine/Core/Collections/RingBuffer.h +++ b/Source/Engine/Core/Collections/RingBuffer.h @@ -75,13 +75,13 @@ public: return _allocation.Get()[_front]; } - FORCE_INLINE T& operator[](int32 index) + FORCE_INLINE T& operator[](const int32 index) { ASSERT(index >= 0 && index < _count); return _allocation.Get()[(_front + index) % _capacity]; } - FORCE_INLINE const T& operator[](int32 index) const + FORCE_INLINE const T& operator[](const int32 index) const { ASSERT(index >= 0 && index < _count); return _allocation.Get()[(_front + index) % _capacity]; diff --git a/Source/Engine/Core/Memory/Allocation.h b/Source/Engine/Core/Memory/Allocation.h index 7d28c70cb..6e8342515 100644 --- a/Source/Engine/Core/Memory/Allocation.h +++ b/Source/Engine/Core/Memory/Allocation.h @@ -39,20 +39,20 @@ public: return (T*)_data; } - FORCE_INLINE int32 CalculateCapacityGrow(int32 capacity, int32 minCapacity) const + FORCE_INLINE int32 CalculateCapacityGrow(int32 capacity, const int32 minCapacity) const { ASSERT(minCapacity <= Capacity); return Capacity; } - FORCE_INLINE void Allocate(int32 capacity) + FORCE_INLINE void Allocate(const int32 capacity) { #if ENABLE_ASSERTION_LOW_LAYERS ASSERT(capacity <= Capacity); #endif } - FORCE_INLINE void Relocate(int32 capacity, int32 oldCount, int32 newCount) + FORCE_INLINE void Relocate(const int32 capacity, int32 oldCount, int32 newCount) { #if ENABLE_ASSERTION_LOW_LAYERS ASSERT(capacity <= Capacity); @@ -104,7 +104,7 @@ public: return _data; } - FORCE_INLINE int32 CalculateCapacityGrow(int32 capacity, int32 minCapacity) const + FORCE_INLINE int32 CalculateCapacityGrow(int32 capacity, const int32 minCapacity) const { if (capacity < minCapacity) capacity = minCapacity; @@ -129,7 +129,7 @@ public: return capacity; } - FORCE_INLINE void Allocate(int32 capacity) + FORCE_INLINE void Allocate(const int32 capacity) { #if ENABLE_ASSERTION_LOW_LAYERS ASSERT(!_data); @@ -141,7 +141,7 @@ public: #endif } - FORCE_INLINE void Relocate(int32 capacity, int32 oldCount, int32 newCount) + FORCE_INLINE void Relocate(const int32 capacity, int32 oldCount, int32 newCount) { T* newData = capacity != 0 ? (T*)Allocator::Allocate(capacity * sizeof(T)) : nullptr; #if !BUILD_RELEASE diff --git a/Source/Engine/Renderer/RenderListBuffer.h b/Source/Engine/Renderer/RenderListBuffer.h index e4f8ab19e..486b1715b 100644 --- a/Source/Engine/Renderer/RenderListBuffer.h +++ b/Source/Engine/Renderer/RenderListBuffer.h @@ -242,7 +242,7 @@ public: /// /// The new capacity. /// True if preserve collection data when changing its size, otherwise collection after resize will be empty. - void SetCapacity(const int32 capacity, bool preserveContents = true) + void SetCapacity(const int32 capacity, const bool preserveContents = true) { if (capacity == Capacity()) return; @@ -365,7 +365,7 @@ private: return (int32)Platform::InterlockedIncrement(&_count) - 1; } - FORCE_INLINE static int32 GetMinCapacity(int32 count) + FORCE_INLINE static int32 GetMinCapacity(const int32 count) { // Ensure there is a slack for others threads to reduce resize counts in highly multi-threaded environment constexpr int32 slack = PLATFORM_THREADS_LIMIT * 8;