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

◆ StartsWithOrdinalHelper()

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

Definition at line 1481 of file CompareInfo.cs.

1482 {
1483 int num = Math.Min(source.Length, prefix.Length);
1484 fixed (char* ptr = &MemoryMarshal.GetReference(source))
1485 {
1486 fixed (char* ptr3 = &MemoryMarshal.GetReference(prefix))
1487 {
1488 char* ptr2 = ptr;
1489 char* ptr4 = ptr3;
1490 while (true)
1491 {
1492 if (num != 0)
1493 {
1494 int num2 = *ptr2;
1495 int num3 = *ptr4;
1496 if (num2 >= 128 || num3 >= 128 || HighCharTable[num2] || HighCharTable[num3])
1497 {
1498 break;
1499 }
1500 if (num2 == num3)
1501 {
1502 ptr2++;
1503 ptr4++;
1504 num--;
1505 continue;
1506 }
1507 if ((ptr2 < ptr + source.Length - 1 && ptr2[1] >= '\u0080') || (ptr4 < ptr3 + prefix.Length - 1 && ptr4[1] >= '\u0080'))
1508 {
1509 break;
1510 }
1511 return false;
1512 }
1513 if (source.Length < prefix.Length)
1514 {
1515 if (*ptr4 >= '\u0080')
1516 {
1517 break;
1518 }
1519 return false;
1520 }
1521 if (source.Length > prefix.Length && *ptr2 >= '\u0080')
1522 {
1523 break;
1524 }
1525 if (matchLengthPtr != null)
1526 {
1527 *matchLengthPtr = prefix.Length;
1528 }
1529 return true;
1530 }
1532 }
1533 }
1534 }
static unsafe bool StartsWith(IntPtr sortHandle, char *target, int cwTargetLength, char *source, int cwSourceLength, CompareOptions options, int *matchedLength)
static ReadOnlySpan< bool > HighCharTable

References System.Globalization.CompareInfo._sortHandle, System.Runtime.Serialization.Dictionary, System.Globalization.CompareInfo.HighCharTable, System.Math.Min(), System.options, System.prefix, System.source, and Interop.Globalization.StartsWith().

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