Skip to content

Commit

Permalink
Rename RefList.EnsureEnoughCapacity to EnsureCapacity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Washi1337 committed May 18, 2022
1 parent cc0fe34 commit 80f5b35
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/AsmResolver/Collections/RefList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public int Capacity
if (value < _count)
throw new ArgumentException("Capacity must be equal or larger than the current number of elements in the list.");

EnsureEnoughCapacity(value);
EnsureCapacity(value);
IncrementVersion();
}
}
Expand Down Expand Up @@ -141,7 +141,7 @@ public ref T GetElementRef(int index, out int version)
/// <param name="item">The element.</param>
public void Add(in T item)
{
EnsureEnoughCapacity(_count + 1);
EnsureCapacity(_count + 1);
_items[_count] = item;
_count++;
IncrementVersion();
Expand Down Expand Up @@ -208,7 +208,7 @@ public bool Remove(in T item)
/// <param name="item">The element to insert.</param>
public void Insert(int index, in T item)
{
EnsureEnoughCapacity(_count + 1);
EnsureCapacity(_count + 1);

if (index < _count)
Array.Copy(_items, index, _items, index + 1, _count - index);
Expand Down Expand Up @@ -260,9 +260,9 @@ private void AssertIsValidIndex(int index)
throw new IndexOutOfRangeException();
}

private void EnsureEnoughCapacity(int requiredCount)
private void EnsureCapacity(int requiredCount)
{
if (_items.Length >= requiredCount)
if (_items.Length >= requiredCount)
return;

int newCapacity = _items.Length == 0 ? 1 : _items.Length * 2;
Expand Down

0 comments on commit 80f5b35

Please sign in to comment.