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

◆ CheckUniqueAndUnfoundElements()

int int UnfoundCount System.Collections.Generic.HashSet< T >.CheckUniqueAndUnfoundElements ( IEnumerable< T > other,
bool returnIfUnfound )
inlineprivate

Definition at line 1109 of file HashSet.cs.

1110 {
1111 if (_count == 0)
1112 {
1113 int num = 0;
1114 using (IEnumerator<T> enumerator = other.GetEnumerator())
1115 {
1116 if (enumerator.MoveNext())
1117 {
1118 T current = enumerator.Current;
1119 num++;
1120 }
1121 }
1122 return (UniqueCount: 0, UnfoundCount: num);
1123 }
1124 int count = _count;
1125 int num2 = BitHelper.ToIntArrayLength(count);
1126 Span<int> span = stackalloc int[100];
1127 BitHelper bitHelper = ((num2 <= 100) ? new BitHelper(span.Slice(0, num2), clear: true) : new BitHelper(new int[num2], clear: false));
1128 int num3 = 0;
1129 int num4 = 0;
1130 foreach (T item in other)
1131 {
1132 int num5 = FindItemIndex(item);
1133 if (num5 >= 0)
1134 {
1135 if (!bitHelper.IsMarked(num5))
1136 {
1137 bitHelper.MarkBit(num5);
1138 num4++;
1139 }
1140 }
1141 else
1142 {
1143 num3++;
1144 if (returnIfUnfound)
1145 {
1146 break;
1147 }
1148 }
1149 }
1150 return (UniqueCount: num4, UnfoundCount: num3);
1151 }

References System.Collections.Generic.HashSet< T >._count, System.count, System.Runtime.Serialization.Dictionary, System.Collections.Generic.HashSet< T >.FindItemIndex(), System.Collections.Generic.Dictionary< TKey, TValue >.GetEnumerator(), System.item, System.other, System.Collections.Generic.BitHelper.ToIntArrayLength(), and System.Collections.Generic.HashSet< T >.UniqueCount.

Referenced by System.Collections.Generic.HashSet< T >.IsProperSubsetOf(), System.Collections.Generic.HashSet< T >.IsProperSupersetOf(), System.Collections.Generic.HashSet< T >.IsSubsetOf(), and System.Collections.Generic.HashSet< T >.SetEquals().