rename to SortHalper

This commit is contained in:
Mikhail 2026-03-16 23:21:00 +08:00
parent ee65362a1b
commit 7422d47b35
3 changed files with 13 additions and 13 deletions

View File

@ -643,7 +643,7 @@ namespace DCFApixels.DragonECS
if (_sortIncChunckBuffer.Length > 1)
{
ArraySortUtility.Sort(sortIncBuffer.AsSpan(), new IncCountComparer(counts));
SortHalper.Sort(sortIncBuffer.AsSpan(), new IncCountComparer(counts));
ConvertToChuncks(preSortingBuffer, sortIncBuffer, _sortIncChunckBuffer);
}
if (_sortIncChunckBuffer.Length > 0)
@ -657,7 +657,7 @@ namespace DCFApixels.DragonECS
if (_sortExcChunckBuffer.Length > 1)
{
ArraySortUtility.Sort(sortExcBuffer.AsSpan(), new ExcCountComparer(counts));
SortHalper.Sort(sortExcBuffer.AsSpan(), new ExcCountComparer(counts));
ConvertToChuncks(preSortingBuffer, sortExcBuffer, _sortExcChunckBuffer);
}
// Выражение IncCount < (AllEntitesCount - ExcCount) мало вероятно будет истинным.
@ -667,7 +667,7 @@ namespace DCFApixels.DragonECS
if (_sortAnyChunckBuffer.Length > 1)
{
ArraySortUtility.Sort(sortAnyBuffer.AsSpan(), new ExcCountComparer(counts));
SortHalper.Sort(sortAnyBuffer.AsSpan(), new ExcCountComparer(counts));
ConvertToChuncks(preSortingBuffer, sortAnyBuffer, _sortAnyChunckBuffer);
}
// Any не влияет на maxEntites если есть Inc и сложно высчитывается если нет Inc

View File

@ -146,7 +146,7 @@ namespace DCFApixels.DragonECS.Core.Internal
public EcsUnsafeSpan Execute(Comparison<int> comparison)
{
Execute_Iternal();
ArraySortUtility.Sort(_filteredAllEntities.AsSpan(_filteredAllEntitiesCount), comparison);
SortHalper.Sort(_filteredAllEntities.AsSpan(_filteredAllEntitiesCount), comparison);
return new EcsUnsafeSpan(World.ID, _filteredAllEntities.Ptr, _filteredAllEntitiesCount);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -157,7 +157,7 @@ namespace DCFApixels.DragonECS.Core.Internal
return Execute(comparison);
}
ExecuteFor_Iternal(source);
ArraySortUtility.Sort(_filteredEntities.AsSpan(_filteredEntitiesCount), comparison);
SortHalper.Sort(_filteredEntities.AsSpan(_filteredEntitiesCount), comparison);
return new EcsUnsafeSpan(World.ID, _filteredEntities.Ptr, _filteredEntitiesCount);
}
#endregion

View File

@ -15,7 +15,7 @@ namespace DCFApixels.DragonECS.Core.Internal
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
internal static unsafe class ArraySortUtility
internal static unsafe class SortHalper
{
internal static StructComparison<T> ToStruct<T>(this Comparison<T> self)
{
@ -28,27 +28,27 @@ namespace DCFApixels.DragonECS.Core.Internal
public static void Sort<T>(Span<T> span)
{
var c = Comparer<T>.Default.ToStruct();
ArraySortUtility<T, StructComparer<T>>.Sort(span, ref c);
SortHalper<T, StructComparer<T>>.Sort(span, ref c);
}
public static void Sort<T>(Span<T> span, Comparer<T> comparer)
{
var c = comparer.ToStruct();
ArraySortUtility<T, StructComparer<T>>.Sort(span, ref c);
SortHalper<T, StructComparer<T>>.Sort(span, ref c);
}
public static void Sort<T>(Span<T> span, Comparison<T> comparison)
{
var c = comparison.ToStruct();
ArraySortUtility<T, StructComparison<T>>.Sort(span, ref c);
SortHalper<T, StructComparison<T>>.Sort(span, ref c);
}
public static void Sort<T, TComparer>(Span<T> span, ref TComparer comparer)
where TComparer : struct, IComparer<T>
{
ArraySortUtility<T, TComparer>.Sort(span, ref comparer);
SortHalper<T, TComparer>.Sort(span, ref comparer);
}
public static void Sort<T, TComparer>(Span<T> span, TComparer comparer)
where TComparer : struct, IComparer<T>
{
ArraySortUtility<T, TComparer>.Sort(span, ref comparer);
SortHalper<T, TComparer>.Sort(span, ref comparer);
}
@ -139,7 +139,7 @@ namespace DCFApixels.DragonECS.Core.Internal
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
internal static class ArraySortUtility<T, TComparer>
internal static class SortHalper<T, TComparer>
where TComparer : struct, IComparer<T>
{
private const int IntrosortSizeThreshold = 16;
@ -209,7 +209,7 @@ namespace DCFApixels.DragonECS.Core.Internal
//Debug.Assert(comparer != null);
if (keys.Length > 1)
{
IntroSort(keys, 2 * (ArraySortUtility.Log2((uint)keys.Length) + 1), ref comparer);
IntroSort(keys, 2 * (SortHalper.Log2((uint)keys.Length) + 1), ref comparer);
}
}