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

◆ And()

unsafe BitArray System.Collections.BitArray.And ( BitArray value)
inline

Definition at line 365 of file BitArray.cs.

366 {
367 if (value == null)
368 {
369 throw new ArgumentNullException("value");
370 }
371 int[] array = m_array;
372 int[] array2 = value.m_array;
373 int int32ArrayLengthFromBitLength = GetInt32ArrayLengthFromBitLength(Length);
374 if (Length != value.Length || (uint)int32ArrayLengthFromBitLength > (uint)array.Length || (uint)int32ArrayLengthFromBitLength > (uint)array2.Length)
375 {
377 }
378 switch (int32ArrayLengthFromBitLength)
379 {
380 case 7:
381 array[6] &= array2[6];
382 goto case 6;
383 case 6:
384 array[5] &= array2[5];
385 goto case 5;
386 case 5:
387 array[4] &= array2[4];
388 goto case 4;
389 case 4:
390 array[3] &= array2[3];
391 goto case 3;
392 case 3:
393 array[2] &= array2[2];
394 goto case 2;
395 case 2:
396 array[1] &= array2[1];
397 goto case 1;
398 case 1:
399 array[0] &= array2[0];
400 break;
401 default:
402 {
403 uint num = 0u;
404 if (Avx2.IsSupported)
405 {
406 fixed (int* ptr = array)
407 {
408 fixed (int* ptr2 = array2)
409 {
410 for (; num < (uint)(int32ArrayLengthFromBitLength - 7); num += 8)
411 {
412 Vector256<int> left = Avx.LoadVector256(ptr + num);
413 Vector256<int> right = Avx.LoadVector256(ptr2 + num);
414 Avx.Store(ptr + num, Avx2.And(left, right));
415 }
416 }
417 }
418 }
419 else if (Sse2.IsSupported)
420 {
421 fixed (int* ptr3 = array)
422 {
423 fixed (int* ptr4 = array2)
424 {
425 for (; num < (uint)(int32ArrayLengthFromBitLength - 3); num += 4)
426 {
427 Vector128<int> left2 = Sse2.LoadVector128(ptr3 + num);
428 Vector128<int> right2 = Sse2.LoadVector128(ptr4 + num);
429 Sse2.Store(ptr3 + num, Sse2.And(left2, right2));
430 }
431 }
432 }
433 }
434 else if (AdvSimd.IsSupported)
435 {
436 fixed (int* ptr5 = array)
437 {
438 fixed (int* ptr6 = array2)
439 {
440 for (; num < (uint)(int32ArrayLengthFromBitLength - 3); num += 4)
441 {
442 Vector128<int> left3 = AdvSimd.LoadVector128(ptr5 + num);
443 Vector128<int> right3 = AdvSimd.LoadVector128(ptr6 + num);
444 AdvSimd.Store(ptr5 + num, AdvSimd.And(left3, right3));
445 }
446 }
447 }
448 }
449 for (; num < (uint)int32ArrayLengthFromBitLength; num++)
450 {
451 array[num] &= array2[num];
452 }
453 break;
454 }
455 case 0:
456 break;
457 }
458 _version++;
459 return this;
460 }
static int GetInt32ArrayLengthFromBitLength(int n)
Definition BitArray.cs:988
static unsafe void Store(byte *address, Vector64< byte > source)
Definition AdvSimd.cs:10249
static unsafe Vector128< byte > LoadVector128(byte *address)
Definition AdvSimd.cs:6034
static Vector64< byte > And(Vector64< byte > left, Vector64< byte > right)
Definition AdvSimd.cs:3919
static Vector256< sbyte > And(Vector256< sbyte > left, Vector256< sbyte > right)
Definition Avx2.cs:132
static new bool IsSupported
Definition Avx2.cs:15
static unsafe Vector256< sbyte > LoadVector256(sbyte *address)
Definition Avx.cs:462
static unsafe void Store(sbyte *address, Vector256< sbyte > source)
Definition Avx.cs:962
static unsafe Vector128< sbyte > LoadVector128(sbyte *address)
Definition Sse2.cs:582
static unsafe void Store(sbyte *address, Vector128< sbyte > source)
Definition Sse2.cs:1287
static Vector128< byte > And(Vector128< byte > left, Vector128< byte > right)
Definition Sse2.cs:132
static new bool IsSupported
Definition Sse2.cs:60
static string Arg_ArrayLengthsDiffer
Definition SR.cs:44
Definition SR.cs:7

References System.Collections.BitArray._version, System.Runtime.Intrinsics.X86.Sse2.And(), System.Runtime.Intrinsics.X86.Avx2.And(), System.Runtime.Intrinsics.Arm.AdvSimd.And(), System.SR.Arg_ArrayLengthsDiffer, System.array, System.Collections.BitArray.GetInt32ArrayLengthFromBitLength(), System.Runtime.Intrinsics.Arm.AdvSimd.IsSupported, System.Runtime.Intrinsics.X86.Avx2.IsSupported, System.Runtime.Intrinsics.X86.Sse2.IsSupported, System.Collections.BitArray.Length, System.Runtime.Intrinsics.Arm.AdvSimd.LoadVector128(), System.Runtime.Intrinsics.X86.Sse2.LoadVector128(), System.Runtime.Intrinsics.X86.Avx.LoadVector256(), System.Collections.BitArray.m_array, System.Runtime.Intrinsics.Arm.AdvSimd.Store(), System.Runtime.Intrinsics.X86.Sse2.Store(), System.Runtime.Intrinsics.X86.Avx.Store(), and System.value.