Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ InternalBinarySearch()

static int System.Collections.Generic.ArraySortHelper< TKey, TValue >.InternalBinarySearch ( T[] array,
int index,
int length,
T value,
IComparer< T > comparer )
inlinestaticpackage

Definition at line 77 of file ArraySortHelper.cs.

78 {
79 int num = index;
80 int num2 = index + length - 1;
81 while (num <= num2)
82 {
83 int num3 = num + (num2 - num >> 1);
84 int num4 = comparer.Compare(array[num3], value);
85 if (num4 == 0)
86 {
87 return num3;
88 }
89 if (num4 < 0)
90 {
91 num = num3 + 1;
92 }
93 else
94 {
95 num2 = num3 - 1;
96 }
97 }
98 return ~num;
99 }

References System.array, System.comparer, System.index, System.length, and System.value.

Referenced by System.Collections.Generic.ArraySortHelper< TKey, TValue >.BinarySearch().