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); }
/// <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); }
public static ref BitVector8 flip(ref BitVector8 x) { math.flip(ref x.data); return(ref x); }
public static ref BitVector8 negate(BitVector8 x, ref BitVector8 z) { math.negate(x.data, ref z.data); return(ref z); }
public static BitVector8 negate(BitVector8 x) => math.negate(x.data);
public static ref BitVector8 negate(ref BitVector8 x) { math.negate(ref x.data); return(ref x); }
public static BitVector8 ToBitVector(this BitString src, N8 n) => BitVector8.FromBitString(src);
public static BitVector8 xor(BitVector8 x, BitVector8 y) => math.xor(x.data, y.data);
public static ref BitVector8 sll(ref BitVector8 x, int offset) { x.assign(Bits.sll(x.Scalar, offset)); return(ref x); }
public static ref BitVector8 srl(BitVector8 x, int offset, ref BitVector8 z) { z.assign(math.srl(x.data, offset)); return(ref z); }
public static BitVector8 srl(BitVector8 x, int offset) => math.srl(x.data, offset);
public static ref BitVector8 srl(ref BitVector8 x, int offset) { math.srl(ref x.data, offset); return(ref x); }
public static BitVector8 and(BitVector8 x, BitVector8 y) => math.and(x.data, y.data);
public static FixedBits <BitVector8, byte> ToFixedBits(this BitVector8 src) => src;
public static BitVector8 flip(BitVector8 x) => math.flip(x.data);
public static ref BitVector8 flip(BitVector8 x, ref BitVector8 z) { z.data = math.flip(x.data); return(ref z); }
public static BitVector8 sll(BitVector8 x, int offset) => Bits.sll(x.Scalar, offset);
public static ref BitVector8 mask(Perm spec, out BitVector8 mask) { mask = BitVector8.Mask(spec); return(ref mask); }
public static ref BitVector8 sll(BitVector8 x, int offset, ref BitVector8 z) { z.assign(Bits.sll(x.Scalar, offset)); return(ref z); }
public static ref BitVector8 xor(BitVector8 x, BitVector8 y, ref BitVector8 z) { math.xor(x.data, y.data, ref z.data); return(ref z); }
public static BitVector <N8, byte> ToGeneric(this BitVector8 src) => src;