Fix for a conflicting patch with one or more of RimCities, Common Sense and Simple Sidearms

This commit is contained in:
bbradson
2024-02-01 23:00:04 +01:00
parent 949bde76ce
commit d394d31f05
5 changed files with 13 additions and 3 deletions
@@ -5,7 +5,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Mono.Collections.Generic;
namespace PerformanceFish.Utility;
@@ -296,6 +295,17 @@ public static class CollectionExtensions
return ThrowForNoElements<T>();
}
public static unsafe void RemoveAtFastUnorderedUnsafe<T>(this List<T> list, int index)
{
fixed (T* lastBucket = &list._items[list._size - 1])
{
list[index] = *lastBucket;
*lastBucket = default;
}
list._size--;
}
public static List<T> AsOrToList<T>(this IEnumerable<T> enumerable) => enumerable as List<T> ?? enumerable.ToList();