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

◆ LastIndexOfAny< T >() [2/3]

static int System.SpanHelpers.LastIndexOfAny< T > ( ref T searchSpace,
T value0,
T value1,
int length )
inlinestatic
Type Constraints
T :IEquatable<T> 

Definition at line 3538 of file SpanHelpers.cs.

3539 {
3540 if (default(T) != null || (value0 != null && value1 != null))
3541 {
3542 while (length >= 8)
3543 {
3544 length -= 8;
3545 T other = Unsafe.Add(ref searchSpace, length + 7);
3546 if (!value0.Equals(other) && !value1.Equals(other))
3547 {
3548 other = Unsafe.Add(ref searchSpace, length + 6);
3549 if (!value0.Equals(other) && !value1.Equals(other))
3550 {
3551 other = Unsafe.Add(ref searchSpace, length + 5);
3552 if (!value0.Equals(other) && !value1.Equals(other))
3553 {
3554 other = Unsafe.Add(ref searchSpace, length + 4);
3555 if (!value0.Equals(other) && !value1.Equals(other))
3556 {
3557 other = Unsafe.Add(ref searchSpace, length + 3);
3558 if (!value0.Equals(other) && !value1.Equals(other))
3559 {
3560 other = Unsafe.Add(ref searchSpace, length + 2);
3561 if (!value0.Equals(other) && !value1.Equals(other))
3562 {
3563 other = Unsafe.Add(ref searchSpace, length + 1);
3564 if (!value0.Equals(other) && !value1.Equals(other))
3565 {
3567 if (!value0.Equals(other) && !value1.Equals(other))
3568 {
3569 continue;
3570 }
3571 goto IL_0351;
3572 }
3573 goto IL_0353;
3574 }
3575 goto IL_0357;
3576 }
3577 goto IL_035b;
3578 }
3579 return length + 4;
3580 }
3581 return length + 5;
3582 }
3583 return length + 6;
3584 }
3585 return length + 7;
3586 }
3587 if (length >= 4)
3588 {
3589 length -= 4;
3590 T other = Unsafe.Add(ref searchSpace, length + 3);
3591 if (value0.Equals(other) || value1.Equals(other))
3592 {
3593 goto IL_035b;
3594 }
3595 other = Unsafe.Add(ref searchSpace, length + 2);
3596 if (value0.Equals(other) || value1.Equals(other))
3597 {
3598 goto IL_0357;
3599 }
3600 other = Unsafe.Add(ref searchSpace, length + 1);
3601 if (value0.Equals(other) || value1.Equals(other))
3602 {
3603 goto IL_0353;
3604 }
3606 if (value0.Equals(other) || value1.Equals(other))
3607 {
3608 goto IL_0351;
3609 }
3610 }
3611 while (length > 0)
3612 {
3613 length--;
3614 T other = Unsafe.Add(ref searchSpace, length);
3615 if (!value0.Equals(other) && !value1.Equals(other))
3616 {
3617 continue;
3618 }
3619 goto IL_0351;
3620 }
3621 }
3622 else
3623 {
3624 for (length--; length >= 0; length--)
3625 {
3626 T other = Unsafe.Add(ref searchSpace, length);
3627 if (other == null)
3628 {
3629 if (value0 != null && value1 != null)
3630 {
3631 continue;
3632 }
3633 }
3634 else if (!other.Equals(value0) && !other.Equals(value1))
3635 {
3636 continue;
3637 }
3638 goto IL_0351;
3639 }
3640 }
3641 return -1;
3642 IL_035b:
3643 return length + 3;
3644 IL_0357:
3645 return length + 2;
3646 IL_0351:
3647 return length;
3648 IL_0353:
3649 return length + 1;
3650 }

References System.length, and System.other.