8internal sealed class GenericArraySortHelper<T> : IArraySortHelper<T> where T :
IComparable<T>
23 if (num ==
keys.Length)
106 int num =
keys.Length;
218 for (
int num =
length >> 1; num >= 1; num--)
231 T left =
keys[i - 1];
251 for (
int i = 0; i < keys.Length - 1; i++)
269 if ((
byte)(
object)left >= (
byte)(
object)right)
277 if ((sbyte)(
object)left >= (sbyte)(
object)right)
285 if ((ushort)(
object)left >= (ushort)(
object)right)
293 if ((
short)(
object)left >= (
short)(
object)right)
301 if ((uint)(
object)left >= (uint)(
object)right)
309 if ((
int)(
object)left >= (
int)(
object)right)
317 if ((ulong)(
object)left >= (ulong)(
object)right)
325 if ((
long)(
object)left >= (
long)(
object)right)
333 if ((nuint)(
UIntPtr)(
object)left >= (nuint)(
UIntPtr)(
object)right)
341 if ((nint)(
IntPtr)(
object)left >= (nint)(
IntPtr)(
object)right)
349 if (!((
float)(
object)left < (
float)(
object)right))
357 if (!((
double)(
object)left < (
double)(
object)right))
365 if (!((
Half)(
object)left < (
Half)(
object)right))
371 if (left.CompareTo(right) >= 0)
383 if ((
byte)(
object)left <= (
byte)(
object)right)
391 if ((sbyte)(
object)left <= (sbyte)(
object)right)
399 if ((ushort)(
object)left <= (ushort)(
object)right)
407 if ((
short)(
object)left <= (
short)(
object)right)
415 if ((uint)(
object)left <= (uint)(
object)right)
423 if ((
int)(
object)left <= (
int)(
object)right)
431 if ((ulong)(
object)left <= (ulong)(
object)right)
439 if ((
long)(
object)left <= (
long)(
object)right)
447 if ((nuint)(
UIntPtr)(
object)left <= (nuint)(
UIntPtr)(
object)right)
455 if ((nint)(
IntPtr)(
object)left <= (nint)(
IntPtr)(
object)right)
463 if (!((
float)(
object)left > (
float)(
object)right))
471 if (!((
double)(
object)left > (
double)(
object)right))
479 if (!((
Half)(
object)left > (
Half)(
object)right))
485 if (left.CompareTo(right) <= 0)
500 if (
keys.Length <= 1)
507 if (num ==
keys.Length)
558 int num =
keys.Length;
596 int num = keys.Length - 1;
641 for (
int num =
length >> 1; num >= 1; num--)
654 TKey left =
keys[i - 1];
655 TValue val =
values[i - 1];
677 for (
int i = 0; i < keys.Length - 1; i++)
679 TKey left =
keys[i + 1];
680 TValue val =
values[i + 1];
688 keys[num + 1] = left;
698 if ((
byte)(
object)left >= (
byte)(
object)right)
706 if ((sbyte)(
object)left >= (sbyte)(
object)right)
714 if ((ushort)(
object)left >= (ushort)(
object)right)
722 if ((
short)(
object)left >= (
short)(
object)right)
730 if ((uint)(
object)left >= (uint)(
object)right)
738 if ((
int)(
object)left >= (
int)(
object)right)
746 if ((ulong)(
object)left >= (ulong)(
object)right)
754 if ((
long)(
object)left >= (
long)(
object)right)
762 if ((nuint)(
UIntPtr)(
object)left >= (nuint)(
UIntPtr)(
object)right)
770 if ((nint)(
IntPtr)(
object)left >= (nint)(
IntPtr)(
object)right)
778 if (!((
float)(
object)left < (
float)(
object)right))
786 if (!((
double)(
object)left < (
double)(
object)right))
794 if (!((
Half)(
object)left < (
Half)(
object)right))
800 if (left.CompareTo(right) >= 0)
812 if ((
byte)(
object)left <= (
byte)(
object)right)
820 if ((sbyte)(
object)left <= (sbyte)(
object)right)
828 if ((ushort)(
object)left <= (ushort)(
object)right)
836 if ((
short)(
object)left <= (
short)(
object)right)
844 if ((uint)(
object)left <= (uint)(
object)right)
852 if ((
int)(
object)left <= (
int)(
object)right)
860 if ((ulong)(
object)left <= (ulong)(
object)right)
868 if ((
long)(
object)left <= (
long)(
object)right)
876 if ((nuint)(
UIntPtr)(
object)left <= (nuint)(
UIntPtr)(
object)right)
884 if ((nint)(
IntPtr)(
object)left <= (nint)(
IntPtr)(
object)right)
892 if (!((
float)(
object)left > (
float)(
object)right))
900 if (!((
double)(
object)left > (
double)(
object)right))
908 if (!((
Half)(
object)left > (
Half)(
object)right))
914 if (left.CompareTo(right) <= 0)
static int PickPivotAndPartition(Span< T > keys)
static void HeapSort(Span< TKey > keys, Span< TValue > values)
static void IntroSort(Span< T > keys, int depthLimit)
static int PickPivotAndPartition(Span< TKey > keys, Span< TValue > values)
static void DownHeap(Span< T > keys, int i, int n)
int BinarySearch(T[] array, int index, int length, T value, IComparer< T > comparer)
static void InsertionSort(Span< TKey > keys, Span< TValue > values)
static void DownHeap(Span< TKey > keys, Span< TValue > values, int i, int n)
static void SwapIfGreater(ref T i, ref T j)
void Sort(Span< T > keys, IComparer< T > comparer)
static bool GreaterThan(ref T left, ref T right)
static bool LessThan(ref T left, ref T right)
static void SwapIfGreaterWithValues(Span< TKey > keys, Span< TValue > values, int i, int j)
static bool LessThan(ref TKey left, ref TKey right)
void Sort(Span< TKey > keys, Span< TValue > values, IComparer< TKey > comparer)
static void HeapSort(Span< T > keys)
static void Swap(Span< TKey > keys, Span< TValue > values, int i, int j)
static void InsertionSort(Span< T > keys)
static void Swap(ref T i, ref T j)
static int BinarySearch(T[] array, int index, int length, T value)
static bool GreaterThan(ref TKey left, ref TKey right)
static void IntroSort(Span< TKey > keys, Span< TValue > values, int depthLimit)
static int Log2(uint value)
static void ThrowArgumentException_BadComparer(object comparer)
static void ThrowInvalidOperationException()