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

◆ IndexOfOrdinalHelper()

unsafe int System.Globalization.CompareInfo.IndexOfOrdinalHelper ( ReadOnlySpan< char > source,
ReadOnlySpan< char > target,
CompareOptions options,
int * matchLengthPtr,
bool fromBeginning )
inlineprivate

Definition at line 1280 of file CompareInfo.cs.

1281 {
1282 fixed (char* ptr = &MemoryMarshal.GetReference(source))
1283 {
1284 fixed (char* ptr3 = &MemoryMarshal.GetReference(target))
1285 {
1286 char* ptr2 = ptr;
1287 char* ptr4 = ptr3;
1288 int num = 0;
1289 while (true)
1290 {
1291 if (num < target.Length)
1292 {
1293 char c = ptr4[num];
1294 if (c >= '\u0080' || HighCharTable[c])
1295 {
1296 break;
1297 }
1298 num++;
1299 continue;
1300 }
1301 if (target.Length > source.Length)
1302 {
1303 int num2 = 0;
1304 while (true)
1305 {
1306 if (num2 < source.Length)
1307 {
1308 char c2 = ptr2[num2];
1309 if (c2 >= '\u0080' || HighCharTable[c2])
1310 {
1311 break;
1312 }
1313 num2++;
1314 continue;
1315 }
1316 return -1;
1317 }
1318 break;
1319 }
1320 int num3;
1321 int num4;
1322 int num5;
1323 if (fromBeginning)
1324 {
1325 num3 = 0;
1327 num5 = 1;
1328 }
1329 else
1330 {
1331 num3 = source.Length - target.Length;
1332 num4 = -1;
1333 num5 = -1;
1334 }
1335 int num6 = num3;
1336 while (true)
1337 {
1338 int num8;
1339 if (num6 != num4)
1340 {
1341 int num7 = 0;
1342 num8 = num6;
1343 while (true)
1344 {
1345 if (num7 < target.Length)
1346 {
1347 char c3 = ptr2[num8];
1348 char c4 = ptr4[num7];
1349 if (c3 >= '\u0080' || HighCharTable[c3])
1350 {
1351 break;
1352 }
1353 if (c3 == c4)
1354 {
1355 num7++;
1356 num8++;
1357 continue;
1358 }
1359 goto IL_0135;
1360 }
1361 if (num8 < source.Length && ptr2[num8] >= '\u0080')
1362 {
1363 break;
1364 }
1365 if (matchLengthPtr != null)
1366 {
1367 *matchLengthPtr = target.Length;
1368 }
1369 return num6;
1370 }
1371 break;
1372 }
1373 return -1;
1374 IL_0135:
1375 if (num8 < source.Length - 1 && (ptr2 + num8)[1] >= '\u0080')
1376 {
1377 break;
1378 }
1379 num6 += num5;
1380 }
1381 break;
1382 }
1383 if (fromBeginning)
1384 {
1386 }
1388 }
1389 }
1390 }
static unsafe int IndexOf(IntPtr sortHandle, char *target, int cwTargetLength, char *pSource, int cwSourceLength, CompareOptions options, int *matchLengthPtr)
static unsafe int LastIndexOf(IntPtr sortHandle, char *target, int cwTargetLength, char *pSource, int cwSourceLength, CompareOptions options, int *matchLengthPtr)
static ReadOnlySpan< bool > HighCharTable

References System.Globalization.CompareInfo._sortHandle, System.Runtime.Serialization.Dictionary, System.Globalization.CompareInfo.HighCharTable, Interop.Globalization.IndexOf(), Interop.Globalization.LastIndexOf(), System.options, and System.source.

Referenced by System.Globalization.CompareInfo.IcuIndexOfCore().