예제 #1
0
        public static Vector256 <ushort> op_RightShift(Vector256 <ushort> vector, Vector256 <ushort> count)
        {
            Vector256 <uint> loMask      = Vector256.Create((uint)0xFFFF);
            Vector256 <uint> vectorChunk = vector.As <uint>() & loMask;
            Vector256 <uint> countChunk  = count.As <uint>() & loMask;
            Vector256 <uint> result      = Avx2.ShiftRightLogicalVariable(vectorChunk, countChunk) & loMask;

            vectorChunk = Avx2.ShiftRightLogical(vector.As <uint>(), 16);
            countChunk  = Avx2.ShiftRightLogical(count.As <uint>(), 16);
            result     |= Avx2.ShiftLeftLogical(Avx2.ShiftRightLogicalVariable(vectorChunk, countChunk) & loMask, 16);
            return(result.As <ushort>());
        }
예제 #2
0
        public static Vector256 <byte> op_Multiply(Vector256 <byte> left, Vector256 <byte> right)
        {
            Vector256 <ushort> lowBits = Vector256.Create((ushort)0x00FF);
            var lowProduct             = Avx2.And(lowBits, Avx2.MultiplyLow(left.As <ushort>(), right.As <ushort>())).AsByte();
            var highProduct            =
                Avx2.ShiftLeftLogical(
                    Avx2.MultiplyLow(
                        Avx2.ShiftRightLogical(left.As <ushort>(), 8),
                        Avx2.ShiftRightLogical(right.As <ushort>(), 8)
                        ),
                    8).AsByte();

            return(Avx2.Or(lowProduct, highProduct));
        }
예제 #3
0
        public static Vector256 <byte> op_RightShift(Vector256 <byte> vector, byte count)
        {
            var highBits = Vector256.Create((ushort)0xFF00);
            var loBits   = Vector256.Create((ushort)0xFF);
            var mask     = Avx2.Or(highBits, Avx2.ShiftRightLogical(loBits, count));

            return(Avx2.And(Avx2.ShiftRightLogical(vector.As <ushort>(), count), mask).AsByte());
        }
예제 #4
0
 public static Vector256 <sbyte> op_RightShift(Vector256 <sbyte> vector, Vector256 <sbyte> count)
 => op_RightShift(vector, count.As <byte>());
예제 #5
0
 public static Vector256 <sbyte> op_LeftShift(Vector256 <sbyte> vector, Vector256 <byte> count)
 => op_LeftShift(vector.As <byte>(), count).As <sbyte>();
예제 #6
0
 public static Vector256 <sbyte> op_RightShift(Vector256 <sbyte> vector, byte count)
 => op_RightShift(vector.As <byte>(), count).As <sbyte>();
예제 #7
0
 public static Vector256 <sbyte> op_Multiply(Vector256 <sbyte> left, Vector256 <sbyte> right)
 => op_Multiply(left.As <byte>(), right.As <byte>()).As <sbyte>();
예제 #8
0
 public static Vector256 <short> op_RightShift(Vector256 <short> vector, Vector256 <short> count)
 => op_RightShift(vector, count.As <ushort>());
예제 #9
0
 public static Vector256 <short> op_LeftShift(Vector256 <short> vector, Vector256 <ushort> count)
 => op_LeftShift(vector.As <ushort>(), count).As <short>();
예제 #10
0
        public static Vector256 <uint> op_GreaterThan(Vector256 <uint> left, Vector256 <uint> right)
        {
            var offset = Vector256.Create(int.MinValue);

            return(Avx2.CompareGreaterThan(Avx2.Add(left.As <int>(), offset), Avx2.Add(right.As <int>(), offset)).AsUInt32());
        }
예제 #11
0
 public static Vector256 <uint> op_LeftShift(Vector256 <uint> vector, Vector256 <int> count)
 => Avx2.ShiftLeftLogicalVariable(vector, count.As <uint>());
예제 #12
0
 public static Vector256 <long> op_RightShift(Vector256 <long> vector, Vector256 <long> count)
 => Avx2.ShiftRightLogicalVariable(vector, count.As <ulong>());
예제 #13
0
        public static Vector256 <byte> op_GreaterThan(Vector256 <byte> left, Vector256 <byte> right)
        {
            var offset = Vector256.Create(sbyte.MinValue);

            return(Avx2.CompareGreaterThan(Avx2.Add(left.As <sbyte>(), offset), Avx2.Add(right.As <sbyte>(), offset)).AsByte());
        }
예제 #14
0
 public static Vector256 <bool> op_LogicalNot(Vector256 <bool> vector)
 => (Vector256.Create((byte)1) ^ vector.As <byte>()).As <bool>();