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

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

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

Definition at line 3364 of file SpanHelpers.cs.

3365 {
3366 if (valueLength == 0)
3367 {
3368 return -1;
3369 }
3370 if (typeof(T).IsValueType)
3371 {
3372 for (int i = 0; i < searchSpaceLength; i++)
3373 {
3374 T other = Unsafe.Add(ref searchSpace, i);
3375 for (int j = 0; j < valueLength; j++)
3376 {
3377 if (Unsafe.Add(ref value, j).Equals(other))
3378 {
3379 return i;
3380 }
3381 }
3382 }
3383 }
3384 else
3385 {
3386 for (int k = 0; k < searchSpaceLength; k++)
3387 {
3388 T val = Unsafe.Add(ref searchSpace, k);
3389 if (val != null)
3390 {
3391 for (int l = 0; l < valueLength; l++)
3392 {
3393 if (val.Equals(Unsafe.Add(ref value, l)))
3394 {
3395 return k;
3396 }
3397 }
3398 continue;
3399 }
3400 for (int m = 0; m < valueLength; m++)
3401 {
3402 if (Unsafe.Add(ref value, m) == null)
3403 {
3404 return k;
3405 }
3406 }
3407 }
3408 }
3409 return -1;
3410 }

References System.other, and System.value.