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

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

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

Definition at line 3249 of file SpanHelpers.cs.

3250 {
3251 int i = 0;
3252 if (default(T) != null || (value0 != null && value1 != null && value2 != null))
3253 {
3254 while (length - i >= 8)
3255 {
3256 T other = Unsafe.Add(ref searchSpace, i);
3257 if (value0.Equals(other) || value1.Equals(other) || value2.Equals(other))
3258 {
3259 goto IL_0471;
3260 }
3261 other = Unsafe.Add(ref searchSpace, i + 1);
3262 if (value0.Equals(other) || value1.Equals(other) || value2.Equals(other))
3263 {
3264 goto IL_0473;
3265 }
3266 other = Unsafe.Add(ref searchSpace, i + 2);
3267 if (value0.Equals(other) || value1.Equals(other) || value2.Equals(other))
3268 {
3269 goto IL_0477;
3270 }
3271 other = Unsafe.Add(ref searchSpace, i + 3);
3272 if (!value0.Equals(other) && !value1.Equals(other) && !value2.Equals(other))
3273 {
3274 other = Unsafe.Add(ref searchSpace, i + 4);
3275 if (!value0.Equals(other) && !value1.Equals(other) && !value2.Equals(other))
3276 {
3277 other = Unsafe.Add(ref searchSpace, i + 5);
3278 if (!value0.Equals(other) && !value1.Equals(other) && !value2.Equals(other))
3279 {
3280 other = Unsafe.Add(ref searchSpace, i + 6);
3281 if (!value0.Equals(other) && !value1.Equals(other) && !value2.Equals(other))
3282 {
3283 other = Unsafe.Add(ref searchSpace, i + 7);
3284 if (!value0.Equals(other) && !value1.Equals(other) && !value2.Equals(other))
3285 {
3286 i += 8;
3287 continue;
3288 }
3289 return i + 7;
3290 }
3291 return i + 6;
3292 }
3293 return i + 5;
3294 }
3295 return i + 4;
3296 }
3297 goto IL_047b;
3298 }
3299 if (length - i >= 4)
3300 {
3301 T other = Unsafe.Add(ref searchSpace, i);
3302 if (value0.Equals(other) || value1.Equals(other) || value2.Equals(other))
3303 {
3304 goto IL_0471;
3305 }
3306 other = Unsafe.Add(ref searchSpace, i + 1);
3307 if (value0.Equals(other) || value1.Equals(other) || value2.Equals(other))
3308 {
3309 goto IL_0473;
3310 }
3311 other = Unsafe.Add(ref searchSpace, i + 2);
3312 if (value0.Equals(other) || value1.Equals(other) || value2.Equals(other))
3313 {
3314 goto IL_0477;
3315 }
3316 other = Unsafe.Add(ref searchSpace, i + 3);
3317 if (value0.Equals(other) || value1.Equals(other) || value2.Equals(other))
3318 {
3319 goto IL_047b;
3320 }
3321 i += 4;
3322 }
3323 while (i < length)
3324 {
3325 T other = Unsafe.Add(ref searchSpace, i);
3326 if (!value0.Equals(other) && !value1.Equals(other) && !value2.Equals(other))
3327 {
3328 i++;
3329 continue;
3330 }
3331 goto IL_0471;
3332 }
3333 }
3334 else
3335 {
3336 for (i = 0; i < length; i++)
3337 {
3338 T other = Unsafe.Add(ref searchSpace, i);
3339 if (other == null)
3340 {
3341 if (value0 != null && value1 != null && value2 != null)
3342 {
3343 continue;
3344 }
3345 }
3346 else if (!other.Equals(value0) && !other.Equals(value1) && !other.Equals(value2))
3347 {
3348 continue;
3349 }
3350 goto IL_0471;
3351 }
3352 }
3353 return -1;
3354 IL_0473:
3355 return i + 1;
3356 IL_047b:
3357 return i + 3;
3358 IL_0471:
3359 return i;
3360 IL_0477:
3361 return i + 2;
3362 }

References System.length, and System.other.