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

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

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

Definition at line 3134 of file SpanHelpers.cs.

3135 {
3136 int i = 0;
3137 if (default(T) != null || (value0 != null && value1 != null))
3138 {
3139 while (length - i >= 8)
3140 {
3141 T other = Unsafe.Add(ref searchSpace, i);
3142 if (value0.Equals(other) || value1.Equals(other))
3143 {
3144 goto IL_0350;
3145 }
3146 other = Unsafe.Add(ref searchSpace, i + 1);
3147 if (value0.Equals(other) || value1.Equals(other))
3148 {
3149 goto IL_0352;
3150 }
3151 other = Unsafe.Add(ref searchSpace, i + 2);
3152 if (value0.Equals(other) || value1.Equals(other))
3153 {
3154 goto IL_0356;
3155 }
3156 other = Unsafe.Add(ref searchSpace, i + 3);
3157 if (!value0.Equals(other) && !value1.Equals(other))
3158 {
3159 other = Unsafe.Add(ref searchSpace, i + 4);
3160 if (!value0.Equals(other) && !value1.Equals(other))
3161 {
3162 other = Unsafe.Add(ref searchSpace, i + 5);
3163 if (!value0.Equals(other) && !value1.Equals(other))
3164 {
3165 other = Unsafe.Add(ref searchSpace, i + 6);
3166 if (!value0.Equals(other) && !value1.Equals(other))
3167 {
3168 other = Unsafe.Add(ref searchSpace, i + 7);
3169 if (!value0.Equals(other) && !value1.Equals(other))
3170 {
3171 i += 8;
3172 continue;
3173 }
3174 return i + 7;
3175 }
3176 return i + 6;
3177 }
3178 return i + 5;
3179 }
3180 return i + 4;
3181 }
3182 goto IL_035a;
3183 }
3184 if (length - i >= 4)
3185 {
3186 T other = Unsafe.Add(ref searchSpace, i);
3187 if (value0.Equals(other) || value1.Equals(other))
3188 {
3189 goto IL_0350;
3190 }
3191 other = Unsafe.Add(ref searchSpace, i + 1);
3192 if (value0.Equals(other) || value1.Equals(other))
3193 {
3194 goto IL_0352;
3195 }
3196 other = Unsafe.Add(ref searchSpace, i + 2);
3197 if (value0.Equals(other) || value1.Equals(other))
3198 {
3199 goto IL_0356;
3200 }
3201 other = Unsafe.Add(ref searchSpace, i + 3);
3202 if (value0.Equals(other) || value1.Equals(other))
3203 {
3204 goto IL_035a;
3205 }
3206 i += 4;
3207 }
3208 while (i < length)
3209 {
3210 T other = Unsafe.Add(ref searchSpace, i);
3211 if (!value0.Equals(other) && !value1.Equals(other))
3212 {
3213 i++;
3214 continue;
3215 }
3216 goto IL_0350;
3217 }
3218 }
3219 else
3220 {
3221 for (i = 0; i < length; i++)
3222 {
3223 T other = Unsafe.Add(ref searchSpace, i);
3224 if (other == null)
3225 {
3226 if (value0 != null && value1 != null)
3227 {
3228 continue;
3229 }
3230 }
3231 else if (!other.Equals(value0) && !other.Equals(value1))
3232 {
3233 continue;
3234 }
3235 goto IL_0350;
3236 }
3237 }
3238 return -1;
3239 IL_0352:
3240 return i + 1;
3241 IL_0350:
3242 return i;
3243 IL_0356:
3244 return i + 2;
3245 IL_035a:
3246 return i + 3;
3247 }

References System.length, and System.other.