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

◆ EqualsIgnoreCase()

static bool System.Globalization.Ordinal.EqualsIgnoreCase ( ref char charA,
ref char charB,
int length )
inlinestaticpackage

Definition at line 57 of file Ordinal.cs.

58 {
59 IntPtr zero = IntPtr.Zero;
60 while (true)
61 {
62 if ((uint)length >= 4u)
63 {
64 ulong num = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, zero)));
65 ulong num2 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, zero)));
66 ulong num3 = num | num2;
67 if (!Utf16Utility.AllCharsInUInt32AreAscii((uint)((int)num3 | (int)(num3 >> 32))))
68 {
69 break;
70 }
72 {
73 return false;
74 }
75 zero += 8;
76 length -= 4;
77 continue;
78 }
79 if ((uint)length >= 2u)
80 {
81 uint num4 = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, zero)));
82 uint num5 = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, zero)));
83 if (!Utf16Utility.AllCharsInUInt32AreAscii(num4 | num5))
84 {
85 break;
86 }
88 {
89 return false;
90 }
91 zero += 4;
92 length -= 2;
93 }
94 if (length != 0)
95 {
96 uint num6 = Unsafe.AddByteOffset(ref charA, zero);
97 uint num7 = Unsafe.AddByteOffset(ref charB, zero);
98 if ((num6 | num7) > 127)
99 {
100 break;
101 }
102 if (num6 == num7)
103 {
104 return true;
105 }
106 num6 |= 0x20u;
107 if (num6 - 97 > 25)
108 {
109 return false;
110 }
111 if (num6 != (num7 | 0x20))
112 {
113 return false;
114 }
115 return true;
116 }
117 return true;
118 }
119 return CompareStringIgnoreCase(ref Unsafe.AddByteOffset(ref charA, zero), length, ref Unsafe.AddByteOffset(ref charB, zero), length) == 0;
120 }
static int CompareStringIgnoreCase(ref char strA, int lengthA, ref char strB, int lengthB)
Definition Ordinal.cs:8
static bool UInt32OrdinalIgnoreCaseAscii(uint valueA, uint valueB)
static bool AllCharsInUInt32AreAscii(uint value)
static bool UInt64OrdinalIgnoreCaseAscii(ulong valueA, ulong valueB)

References System.Text.Unicode.Utf16Utility.AllCharsInUInt32AreAscii(), System.Globalization.Ordinal.CompareStringIgnoreCase(), System.length, System.Text.Unicode.Utf16Utility.UInt32OrdinalIgnoreCaseAscii(), System.Text.Unicode.Utf16Utility.UInt64OrdinalIgnoreCaseAscii(), and System.IntPtr.Zero.

Referenced by System.MemoryExtensions.EndsWithOrdinalIgnoreCase(), System.OrdinalIgnoreCaseComparer.Equals(), System.OrdinalComparer.Equals(), System.MemoryExtensions.EqualsOrdinalIgnoreCase(), System.String.EqualsOrdinalIgnoreCaseNoLengthCheck(), System.Globalization.IdnMapping.GetStringForOutput(), System.String.StartsWith(), and System.MemoryExtensions.StartsWithOrdinalIgnoreCase().