//public struct DefaultComparer<T> : IComparer<T> where T : IComparable<T> //{ // public int Compare(T x, T y) => x?.CompareTo(y) ?? 0; //} //unsafe public static void Sort<T>(this NativeBuffer<T> array) where T : struct, IComparable<T> //{ // array.Sort(new DefaultComparer<T>()); //} unsafe public static void Sort <T, U>(this NativeBuffer <T> array, U comp) where T : struct where U : IComparer <T> { IntroSort <T, U>(array.GetUnsafePtr(), 0, array.Length - 1, 2 * math_2.log2_floor(array.Length), comp); }
public unsafe void *GetUnsafePtr() => _buffer.GetUnsafePtr();