other/Utils/Collection/BetterList.cs
/// <summary>
/// Ensures that the capacity of this list is at least the given minimum value. 
/// If the currect capacity of the list is less than min, the capacity is increased to twice the current capacity or to min, whichever is larger.
/// </summary>
Ensures that the capacity of this list is at least the given minimum value.
If the currect capacity of the list is less than min, the capacity is increased to twice the current capacity or to min, whichever is larger.
Ensures that the capacity of this list is at least the given minimum value . If the currect capacity of the list is less than min the capacity is increased to twice the current capacity or to min whichever is larger .
private void EnsureCapacity(int min)
	{
		if (m_Items.Length < min)
		{
			int newCapacity = m_Items.Length == 0 ? DEFAULT_CAPACITY : m_Items.Length * 2;
			if ((uint)newCapacity > MAX_ARRAY_LENGTH)
			{
				newCapacity = MAX_ARRAY_LENGTH;
			}
			if (newCapacity < min)
			{
				newCapacity = min;
			}
			Capacity = newCapacity;
		}
	}
private void EnsureCapacity ( int min ) { if ( m_Items . Length < min ) { int newCapacity = m_Items . Length == 0 ? DEFAULT_CAPACITY : m_Items . Length * 2 ; if ( ( uint ) newCapacity > MAX_ARRAY_LENGTH ) { newCapacity = MAX_ARRAY_LENGTH ; } if ( newCapacity < min ) { newCapacity = min ; } Capacity = newCapacity ; } }
Ensures that the capacity of this list is at least the given minimum value.
Ensures that the capacity of this list is at least the given minimum value .
// Allow the list to grow to maximum possible capacity (~2G elements) before encountering overflow. // Note that this check works even when _items.Length overflowed thanks to the (uint) cast
min
int