98 {
99 int num = Math.Min(lengthA, lengthB);
100 ref char reference = ref strA;
101 ref char reference2 = ref strB;
102 int num2 = 0;
103 while (num2 < num)
104 {
105 char c = reference;
106 char c2 = reference2;
107 char c3 = '\0';
108 if (!
char.IsHighSurrogate(c) || num2 >= lengthA - 1 || !
char.IsLowSurrogate(c3 =
Unsafe.Add(ref reference, 1)))
109 {
110 if (!
char.IsHighSurrogate(c2) || num2 >= lengthB - 1 || !
char.IsLowSurrogate(
Unsafe.Add(ref reference2, 1)))
111 {
112 if (c2 == c)
113 {
114 num2++;
115 reference = ref
Unsafe.Add(ref reference, 1);
116 reference2 = ref
Unsafe.Add(ref reference2, 1);
117 continue;
118 }
121 if (c4 == c5)
122 {
123 num2++;
124 reference = ref
Unsafe.Add(ref reference, 1);
125 reference2 = ref
Unsafe.Add(ref reference2, 1);
126 continue;
127 }
128 return c - c2;
129 }
130 return -1;
131 }
132 char c6 = '\0';
133 if (!
char.IsHighSurrogate(c2) || num2 >= lengthB - 1 || !
char.IsLowSurrogate(c6 =
Unsafe.Add(ref reference2, 1)))
134 {
135 return 1;
136 }
137 if (c == c2 && c3 == c6)
138 {
139 num2 += 2;
140 reference = ref
Unsafe.Add(ref reference, 2);
141 reference2 = ref
Unsafe.Add(ref reference2, 2);
142 continue;
143 }
146 if (num3 == num4)
147 {
148 num2 += 2;
149 reference = ref
Unsafe.Add(ref reference, 2);
150 reference2 = ref
Unsafe.Add(ref reference2, 2);
151 continue;
152 }
153 return (int)(num3 - num4);
154 }
155 return lengthA - lengthB;
156 }
static char ToUpper(char c)
static uint GetScalarFromUtf16SurrogatePair(uint highSurrogateCodePoint, uint lowSurrogateCodePoint)