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

◆ EndsWithOrdinalHelper()

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

Definition at line 1625 of file CompareInfo.cs.

1626 {
1627 int num = Math.Min(source.Length, suffix.Length);
1628 fixed (char* ptr = &MemoryMarshal.GetReference(source))
1629 {
1630 fixed (char* ptr3 = &MemoryMarshal.GetReference(suffix))
1631 {
1632 char* ptr2 = ptr + source.Length - 1;
1633 char* ptr4 = ptr3 + suffix.Length - 1;
1634 while (true)
1635 {
1636 if (num != 0)
1637 {
1638 int num2 = *ptr2;
1639 int num3 = *ptr4;
1640 if (num2 >= 128 || num3 >= 128 || HighCharTable[num2] || HighCharTable[num3])
1641 {
1642 break;
1643 }
1644 if (num2 == num3)
1645 {
1646 ptr2--;
1647 ptr4--;
1648 num--;
1649 continue;
1650 }
1651 if ((ptr2 > ptr && *(ptr2 - 1) >= '\u0080') || (ptr4 > ptr3 && *(ptr4 - 1) >= '\u0080'))
1652 {
1653 break;
1654 }
1655 return false;
1656 }
1657 if (source.Length < suffix.Length)
1658 {
1659 if (*ptr4 >= '\u0080')
1660 {
1661 break;
1662 }
1663 return false;
1664 }
1665 if (source.Length > suffix.Length && *ptr2 >= '\u0080')
1666 {
1667 break;
1668 }
1669 if (matchLengthPtr != null)
1670 {
1671 *matchLengthPtr = suffix.Length;
1672 }
1673 return true;
1674 }
1676 }
1677 }
1678 }
static unsafe bool EndsWith(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, Interop.Globalization.EndsWith(), System.Globalization.CompareInfo.HighCharTable, System.Math.Min(), System.options, System.source, and System.suffix.

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