mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2026-04-22 01:45:55 +08:00
rename to SortHalper
This commit is contained in:
parent
ee65362a1b
commit
7422d47b35
@ -643,7 +643,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
if (_sortIncChunckBuffer.Length > 1)
|
if (_sortIncChunckBuffer.Length > 1)
|
||||||
{
|
{
|
||||||
ArraySortUtility.Sort(sortIncBuffer.AsSpan(), new IncCountComparer(counts));
|
SortHalper.Sort(sortIncBuffer.AsSpan(), new IncCountComparer(counts));
|
||||||
ConvertToChuncks(preSortingBuffer, sortIncBuffer, _sortIncChunckBuffer);
|
ConvertToChuncks(preSortingBuffer, sortIncBuffer, _sortIncChunckBuffer);
|
||||||
}
|
}
|
||||||
if (_sortIncChunckBuffer.Length > 0)
|
if (_sortIncChunckBuffer.Length > 0)
|
||||||
@ -657,7 +657,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
if (_sortExcChunckBuffer.Length > 1)
|
if (_sortExcChunckBuffer.Length > 1)
|
||||||
{
|
{
|
||||||
ArraySortUtility.Sort(sortExcBuffer.AsSpan(), new ExcCountComparer(counts));
|
SortHalper.Sort(sortExcBuffer.AsSpan(), new ExcCountComparer(counts));
|
||||||
ConvertToChuncks(preSortingBuffer, sortExcBuffer, _sortExcChunckBuffer);
|
ConvertToChuncks(preSortingBuffer, sortExcBuffer, _sortExcChunckBuffer);
|
||||||
}
|
}
|
||||||
// Выражение IncCount < (AllEntitesCount - ExcCount) мало вероятно будет истинным.
|
// Выражение IncCount < (AllEntitesCount - ExcCount) мало вероятно будет истинным.
|
||||||
@ -667,7 +667,7 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
if (_sortAnyChunckBuffer.Length > 1)
|
if (_sortAnyChunckBuffer.Length > 1)
|
||||||
{
|
{
|
||||||
ArraySortUtility.Sort(sortAnyBuffer.AsSpan(), new ExcCountComparer(counts));
|
SortHalper.Sort(sortAnyBuffer.AsSpan(), new ExcCountComparer(counts));
|
||||||
ConvertToChuncks(preSortingBuffer, sortAnyBuffer, _sortAnyChunckBuffer);
|
ConvertToChuncks(preSortingBuffer, sortAnyBuffer, _sortAnyChunckBuffer);
|
||||||
}
|
}
|
||||||
// Any не влияет на maxEntites если есть Inc и сложно высчитывается если нет Inc
|
// Any не влияет на maxEntites если есть Inc и сложно высчитывается если нет Inc
|
||||||
|
|||||||
@ -146,7 +146,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
public EcsUnsafeSpan Execute(Comparison<int> comparison)
|
public EcsUnsafeSpan Execute(Comparison<int> comparison)
|
||||||
{
|
{
|
||||||
Execute_Iternal();
|
Execute_Iternal();
|
||||||
ArraySortUtility.Sort(_filteredAllEntities.AsSpan(_filteredAllEntitiesCount), comparison);
|
SortHalper.Sort(_filteredAllEntities.AsSpan(_filteredAllEntitiesCount), comparison);
|
||||||
return new EcsUnsafeSpan(World.ID, _filteredAllEntities.Ptr, _filteredAllEntitiesCount);
|
return new EcsUnsafeSpan(World.ID, _filteredAllEntities.Ptr, _filteredAllEntitiesCount);
|
||||||
}
|
}
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@ -157,7 +157,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
return Execute(comparison);
|
return Execute(comparison);
|
||||||
}
|
}
|
||||||
ExecuteFor_Iternal(source);
|
ExecuteFor_Iternal(source);
|
||||||
ArraySortUtility.Sort(_filteredEntities.AsSpan(_filteredEntitiesCount), comparison);
|
SortHalper.Sort(_filteredEntities.AsSpan(_filteredEntitiesCount), comparison);
|
||||||
return new EcsUnsafeSpan(World.ID, _filteredEntities.Ptr, _filteredEntitiesCount);
|
return new EcsUnsafeSpan(World.ID, _filteredEntities.Ptr, _filteredEntitiesCount);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
[Il2CppSetOption(Option.NullChecks, false)]
|
[Il2CppSetOption(Option.NullChecks, false)]
|
||||||
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
|
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
|
||||||
#endif
|
#endif
|
||||||
internal static unsafe class ArraySortUtility
|
internal static unsafe class SortHalper
|
||||||
{
|
{
|
||||||
internal static StructComparison<T> ToStruct<T>(this Comparison<T> self)
|
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)
|
public static void Sort<T>(Span<T> span)
|
||||||
{
|
{
|
||||||
var c = Comparer<T>.Default.ToStruct();
|
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)
|
public static void Sort<T>(Span<T> span, Comparer<T> comparer)
|
||||||
{
|
{
|
||||||
var c = comparer.ToStruct();
|
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)
|
public static void Sort<T>(Span<T> span, Comparison<T> comparison)
|
||||||
{
|
{
|
||||||
var c = comparison.ToStruct();
|
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)
|
public static void Sort<T, TComparer>(Span<T> span, ref TComparer comparer)
|
||||||
where TComparer : struct, IComparer<T>
|
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)
|
public static void Sort<T, TComparer>(Span<T> span, TComparer comparer)
|
||||||
where TComparer : struct, IComparer<T>
|
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.NullChecks, false)]
|
||||||
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
|
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
|
||||||
#endif
|
#endif
|
||||||
internal static class ArraySortUtility<T, TComparer>
|
internal static class SortHalper<T, TComparer>
|
||||||
where TComparer : struct, IComparer<T>
|
where TComparer : struct, IComparer<T>
|
||||||
{
|
{
|
||||||
private const int IntrosortSizeThreshold = 16;
|
private const int IntrosortSizeThreshold = 16;
|
||||||
@ -209,7 +209,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
|||||||
//Debug.Assert(comparer != null);
|
//Debug.Assert(comparer != null);
|
||||||
if (keys.Length > 1)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user