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

◆ Or()

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

Definition at line 462 of file BitArray.cs.

463 {
464 if (value == null)
465 {
466 throw new ArgumentNullException("value");
467 }
468 int[] array = m_array;
469 int[] array2 = value.m_array;
470 int int32ArrayLengthFromBitLength = GetInt32ArrayLengthFromBitLength(Length);
471 if (Length != value.Length || (uint)int32ArrayLengthFromBitLength > (uint)array.Length || (uint)int32ArrayLengthFromBitLength > (uint)array2.Length)
472 {
474 }
475 switch (int32ArrayLengthFromBitLength)
476 {
477 case 7:
478 array[6] |= array2[6];
479 goto case 6;
480 case 6:
481 array[5] |= array2[5];
482 goto case 5;
483 case 5:
484 array[4] |= array2[4];
485 goto case 4;
486 case 4:
487 array[3] |= array2[3];
488 goto case 3;
489 case 3:
490 array[2] |= array2[2];
491 goto case 2;
492 case 2:
493 array[1] |= array2[1];
494 goto case 1;
495 case 1:
496 array[0] |= array2[0];
497 break;
498 default:
499 {
500 uint num = 0u;
501 if (Avx2.IsSupported)
502 {
503 fixed (int* ptr = array)
504 {
505 fixed (int* ptr2 = array2)
506 {
507 for (; num < (uint)(int32ArrayLengthFromBitLength - 7); num += 8)
508 {
509 Vector256<int> left = Avx.LoadVector256(ptr + num);
510 Vector256<int> right = Avx.LoadVector256(ptr2 + num);
511 Avx.Store(ptr + num, Avx2.Or(left, right));
512 }
513 }
514 }
515 }
516 else if (Sse2.IsSupported)
517 {
518 fixed (int* ptr3 = array)
519 {
520 fixed (int* ptr4 = array2)
521 {
522 for (; num < (uint)(int32ArrayLengthFromBitLength - 3); num += 4)
523 {
524 Vector128<int> left2 = Sse2.LoadVector128(ptr3 + num);
525 Vector128<int> right2 = Sse2.LoadVector128(ptr4 + num);
526 Sse2.Store(ptr3 + num, Sse2.Or(left2, right2));
527 }
528 }
529 }
530 }
531 else if (AdvSimd.IsSupported)
532 {
533 fixed (int* ptr5 = array)
534 {
535 fixed (int* ptr6 = array2)
536 {
537 for (; num < (uint)(int32ArrayLengthFromBitLength - 3); num += 4)
538 {
539 Vector128<int> left3 = AdvSimd.LoadVector128(ptr5 + num);
540 Vector128<int> right3 = AdvSimd.LoadVector128(ptr6 + num);
541 AdvSimd.Store(ptr5 + num, AdvSimd.Or(left3, right3));
542 }
543 }
544 }
545 }
546 for (; num < (uint)int32ArrayLengthFromBitLength; num++)
547 {
548 array[num] |= array2[num];
549 }
550 break;
551 }
552 case 0:
553 break;
554 }
555 _version++;
556 return this;
557 }
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 > Or(Vector64< byte > left, Vector64< byte > right)
Definition AdvSimd.cs:7934
static new bool IsSupported
Definition Avx2.cs:15
static Vector256< sbyte > Or(Vector256< sbyte > left, Vector256< sbyte > right)
Definition Avx2.cs:1638
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 > Or(Vector128< byte > left, Vector128< byte > right)
Definition Sse2.cs:837
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.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.X86.Sse2.Or(), System.Runtime.Intrinsics.X86.Avx2.Or(), System.Runtime.Intrinsics.Arm.AdvSimd.Or(), System.Runtime.Intrinsics.Arm.AdvSimd.Store(), System.Runtime.Intrinsics.X86.Sse2.Store(), System.Runtime.Intrinsics.X86.Avx.Store(), and System.value.