/// <summary> /// Insertion sort /// </summary> /// <param name="arr">Array to sort.</param> /// <param name="sortSize">Size of the array to sort. If greater than array capacity, it will get clamped.</param> public static unsafe void InsertionSort(NativeArray <uint> arr, int sortSize) { sortSize = Math.Min(arr.Length, sortSize); if (!arr.IsCreated || sortSize == 0) { return; } CoreUnsafeUtils.InsertionSort((uint *)arr.GetUnsafePtr(), sortSize); }
/// <summary> /// Insertion sort /// </summary> /// <param name="arr">Array to sort.</param> /// <param name="sortSize">Size of the array to sort. If greater than array capacity, it will get clamped.</param> public static unsafe void InsertionSort(uint[] arr, int sortSize) { sortSize = Math.Min(arr.Length, sortSize); if (arr == null || sortSize == 0) { return; fixed(uint *ptr = arr) CoreUnsafeUtils.InsertionSort(ptr, sortSize); }