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

◆ LastIndexOf< T >() [2/2]

static int System.SpanHelpers.LastIndexOf< T > ( ref T searchSpace,
T value,
int length )
inlinestatic
Type Constraints
T :IEquatable<T> 

Definition at line 3443 of file SpanHelpers.cs.

3444 {
3445 if (default(T) != null || value != null)
3446 {
3447 while (length >= 8)
3448 {
3449 length -= 8;
3450 if (!value.Equals(Unsafe.Add(ref searchSpace, length + 7)))
3451 {
3452 if (!value.Equals(Unsafe.Add(ref searchSpace, length + 6)))
3453 {
3454 if (!value.Equals(Unsafe.Add(ref searchSpace, length + 5)))
3455 {
3456 if (!value.Equals(Unsafe.Add(ref searchSpace, length + 4)))
3457 {
3458 if (!value.Equals(Unsafe.Add(ref searchSpace, length + 3)))
3459 {
3460 if (!value.Equals(Unsafe.Add(ref searchSpace, length + 2)))
3461 {
3462 if (!value.Equals(Unsafe.Add(ref searchSpace, length + 1)))
3463 {
3464 if (!value.Equals(Unsafe.Add(ref searchSpace, length)))
3465 {
3466 continue;
3467 }
3468 goto IL_01fe;
3469 }
3470 goto IL_0200;
3471 }
3472 goto IL_0204;
3473 }
3474 goto IL_0208;
3475 }
3476 return length + 4;
3477 }
3478 return length + 5;
3479 }
3480 return length + 6;
3481 }
3482 return length + 7;
3483 }
3484 if (length >= 4)
3485 {
3486 length -= 4;
3487 if (value.Equals(Unsafe.Add(ref searchSpace, length + 3)))
3488 {
3489 goto IL_0208;
3490 }
3491 if (value.Equals(Unsafe.Add(ref searchSpace, length + 2)))
3492 {
3493 goto IL_0204;
3494 }
3495 if (value.Equals(Unsafe.Add(ref searchSpace, length + 1)))
3496 {
3497 goto IL_0200;
3498 }
3499 if (value.Equals(Unsafe.Add(ref searchSpace, length)))
3500 {
3501 goto IL_01fe;
3502 }
3503 }
3504 while (length > 0)
3505 {
3506 length--;
3507 if (!value.Equals(Unsafe.Add(ref searchSpace, length)))
3508 {
3509 continue;
3510 }
3511 goto IL_01fe;
3512 }
3513 }
3514 else
3515 {
3516 length--;
3517 while (length >= 0)
3518 {
3519 if (Unsafe.Add(ref searchSpace, length) != null)
3520 {
3521 length--;
3522 continue;
3523 }
3524 goto IL_01fe;
3525 }
3526 }
3527 return -1;
3528 IL_0208:
3529 return length + 3;
3530 IL_0200:
3531 return length + 1;
3532 IL_01fe:
3533 return length;
3534 IL_0204:
3535 return length + 2;
3536 }

References System.length, and System.value.