244 {
246 {
248 {
249 char* ptr2 = ptr + value.Length - 1;
250 for (
char* ptr4 = ptr3 + (
source.Length -
value.Length); ptr4 >= ptr3; ptr4--)
251 {
252 char* ptr5 = ptr;
253 char* ptr6 = ptr4;
254 while (ptr5 <= ptr2)
255 {
256 if (!char.IsHighSurrogate(*ptr5) || ptr5 == ptr2)
257 {
259 {
260 break;
261 }
262 ptr5++;
263 ptr6++;
264 }
265 else if (char.IsHighSurrogate(*ptr6) && char.IsLowSurrogate(ptr6[1]) && char.IsLowSurrogate(ptr5[1]))
266 {
267 if (!SurrogateCasing.Equal(*ptr6, ptr6[1], *ptr5, ptr5[1]))
268 {
269 break;
270 }
271 ptr6 += 2;
272 ptr5 += 2;
273 }
274 else
275 {
276 if (*ptr5 != *ptr6)
277 {
278 break;
279 }
280 ptr6++;
281 ptr5++;
282 }
283 }
284 if (ptr5 > ptr2)
285 {
286 return (int)(ptr4 - ptr3);
287 }
288 }
289 return -1;
290 }
291 }
292 }
static char ToUpper(char c)