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

◆ CompareOrdinalHelper() [2/2]

static unsafe int System.String.CompareOrdinalHelper ( string strA,
string strB )
inlinestaticprivate

Definition at line 143 of file String.cs.

144 {
145 int num = Math.Min(strA.Length, strB.Length);
146 fixed (char* ptr = &strA._firstChar)
147 {
148 fixed (char* ptr3 = &strB._firstChar)
149 {
150 char* ptr2 = ptr;
151 char* ptr4 = ptr3;
152 if (ptr2[1] == ptr4[1])
153 {
154 num -= 2;
155 ptr2 += 2;
156 ptr4 += 2;
157 while (true)
158 {
159 if (num >= 12)
160 {
161 if (*(long*)ptr2 == *(long*)ptr4)
162 {
163 if (*(long*)(ptr2 + 4) == *(long*)(ptr4 + 4))
164 {
165 if (*(long*)(ptr2 + 8) == *(long*)(ptr4 + 8))
166 {
167 num -= 12;
168 ptr2 += 12;
169 ptr4 += 12;
170 continue;
171 }
172 ptr2 += 4;
173 ptr4 += 4;
174 }
175 ptr2 += 4;
176 ptr4 += 4;
177 }
178 if (*(int*)ptr2 == *(int*)ptr4)
179 {
180 ptr2 += 2;
181 ptr4 += 2;
182 }
183 break;
184 }
185 while (true)
186 {
187 if (num > 0)
188 {
189 if (*(int*)ptr2 != *(int*)ptr4)
190 {
191 break;
192 }
193 num -= 2;
194 ptr2 += 2;
195 ptr4 += 2;
196 continue;
197 }
198 return strA.Length - strB.Length;
199 }
200 break;
201 }
202 if (*ptr2 != *ptr4)
203 {
204 return *ptr2 - *ptr4;
205 }
206 }
207 return ptr2[1] - ptr4[1];
208 }
209 }
210 }

References System.Math.Min().