示例#1
0
文件: clmul.cs 项目: 0xCM/arrows
        public static BitVector8 clmulr(BitVector8 a, BitVector8 b, BitVector16 poly)
        {
            var prod = dinx.clmul(a, b);

            prod ^= (ushort)dinx.clmul((ushort)(prod >> 8), poly);
            prod ^= (ushort)dinx.clmul((ushort)(prod >> 8), poly);
            return((byte)prod);
        }
示例#2
0
文件: ModProd.cs 项目: 0xCM/arrows
        /// <summary>
        /// Compultes the scalar product between two bitvectors using modular arithmetic
        /// </summary>
        /// <param name="lhs">The first vector</param>
        /// <param name="rhs">The second vector</param>
        public static int ModProd(BitVector8 lhs, BitVector8 rhs)
        {
            var result = 0;

            for (var i = 0; i < lhs.Length; i++)
            {
                var x = lhs[i] ? 1 : 0;
                var y = rhs[i] ? 1 : 0;
                result += x * y;
            }
            return(result % 2);
        }
示例#3
0
文件: flip.cs 项目: 0xCM/arrows
 public static ref BitVector8 flip(ref BitVector8 x)
 {
     math.flip(ref x.data);
     return(ref x);
 }
示例#4
0
文件: negate.cs 项目: 0xCM/arrows
 public static ref BitVector8 negate(BitVector8 x, ref BitVector8 z)
 {
     math.negate(x.data, ref z.data);
     return(ref z);
 }
示例#5
0
文件: negate.cs 项目: 0xCM/arrows
 public static BitVector8 negate(BitVector8 x)
 => math.negate(x.data);
示例#6
0
文件: negate.cs 项目: 0xCM/arrows
 public static ref BitVector8 negate(ref BitVector8 x)
 {
     math.negate(ref x.data);
     return(ref x);
 }
示例#7
0
 public static BitVector8 ToBitVector(this BitString src, N8 n)
 => BitVector8.FromBitString(src);
示例#8
0
文件: xor.cs 项目: 0xCM/arrows
 public static BitVector8 xor(BitVector8 x, BitVector8 y)
 => math.xor(x.data, y.data);
示例#9
0
 public static ref BitVector8 sll(ref BitVector8 x, int offset)
 {
     x.assign(Bits.sll(x.Scalar, offset));
     return(ref x);
 }
示例#10
0
 public static ref BitVector8 srl(BitVector8 x, int offset, ref BitVector8 z)
 {
     z.assign(math.srl(x.data, offset));
     return(ref z);
 }
示例#11
0
 public static BitVector8 srl(BitVector8 x, int offset)
 => math.srl(x.data, offset);
示例#12
0
 public static ref BitVector8 srl(ref BitVector8 x, int offset)
 {
     math.srl(ref x.data, offset);
     return(ref x);
 }
示例#13
0
文件: and.cs 项目: 0xCM/arrows
 public static BitVector8 and(BitVector8 x, BitVector8 y)
 => math.and(x.data, y.data);
示例#14
0
 public static FixedBits <BitVector8, byte> ToFixedBits(this BitVector8 src)
 => src;
示例#15
0
文件: flip.cs 项目: 0xCM/arrows
 public static BitVector8 flip(BitVector8 x)
 => math.flip(x.data);
示例#16
0
文件: flip.cs 项目: 0xCM/arrows
 public static ref BitVector8 flip(BitVector8 x, ref BitVector8 z)
 {
     z.data = math.flip(x.data);
     return(ref z);
 }
示例#17
0
 public static BitVector8 sll(BitVector8 x, int offset)
 => Bits.sll(x.Scalar, offset);
示例#18
0
文件: mask.cs 项目: 0xCM/arrows
 public static ref BitVector8 mask(Perm spec, out BitVector8 mask)
 {
     mask = BitVector8.Mask(spec);
     return(ref mask);
 }
示例#19
0
 public static ref BitVector8 sll(BitVector8 x, int offset, ref BitVector8 z)
 {
     z.assign(Bits.sll(x.Scalar, offset));
     return(ref z);
 }
示例#20
0
文件: xor.cs 项目: 0xCM/arrows
 public static ref BitVector8 xor(BitVector8 x, BitVector8 y, ref BitVector8 z)
 {
     math.xor(x.data, y.data, ref z.data);
     return(ref z);
 }
示例#21
0
 public static BitVector <N8, byte> ToGeneric(this BitVector8 src)
 => src;