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

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

static int System.SpanHelpers.LastIndexOfAny< T > ( ref T searchSpace,
int searchSpaceLength,
ref T value,
int valueLength )
inlinestatic
Type Constraints
T :IEquatable<T> 

Definition at line 3766 of file SpanHelpers.cs.

3767 {
3768 if (valueLength == 0)
3769 {
3770 return -1;
3771 }
3772 if (typeof(T).IsValueType)
3773 {
3774 for (int num = searchSpaceLength - 1; num >= 0; num--)
3775 {
3776 T other = Unsafe.Add(ref searchSpace, num);
3777 for (int i = 0; i < valueLength; i++)
3778 {
3779 if (Unsafe.Add(ref value, i).Equals(other))
3780 {
3781 return num;
3782 }
3783 }
3784 }
3785 }
3786 else
3787 {
3788 for (int num2 = searchSpaceLength - 1; num2 >= 0; num2--)
3789 {
3790 T val = Unsafe.Add(ref searchSpace, num2);
3791 if (val != null)
3792 {
3793 for (int j = 0; j < valueLength; j++)
3794 {
3795 if (val.Equals(Unsafe.Add(ref value, j)))
3796 {
3797 return num2;
3798 }
3799 }
3800 }
3801 else
3802 {
3803 for (int k = 0; k < valueLength; k++)
3804 {
3805 if (Unsafe.Add(ref value, k) == null)
3806 {
3807 return num2;
3808 }
3809 }
3810 }
3811 }
3812 }
3813 return -1;
3814 }

References System.other, and System.value.