unsafe public static void Sort <T, U>(this NativeSlice <T> slice, U comp) where T : struct where U : IComparer <T>
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            if (slice.Stride != UnsafeUtility.SizeOf <T>())
            {
                throw new InvalidOperationException("Sort requires that stride matches the size of the source type");
            }
#endif

            IntroSort <T, U>(slice.GetUnsafePtr(), 0, slice.Length - 1, 2 * CollectionHelper.log2_floor(slice.Length), comp);
        }
 unsafe public static void Sort <T, U>(this NativeArray <T> array, U comp) where T : struct where U : IComparer <T>
 {
     IntroSort <T, U>(array.GetUnsafePtr(), 0, array.Length - 1, 2 * CollectionHelper.log2_floor(array.Length), comp);
 }
Beispiel #3
0
 unsafe public static void Sort <T, U>(T *array, int length, U comp) where T : unmanaged where U : IComparer <T>
 {
     IntroSort <T, U>(array, 0, length - 1, 2 * CollectionHelper.log2_floor(length), comp);
 }