Esempio n. 1
0
 public void create_8x8()
 {
     var src = Random.Stream<ulong>().Take(Pow2.T07).GetEnumerator();
     while(src.MoveNext())
     {
         var m1 = BitMatrix8.From(src.Current);
         var n = new N8();
         var m2 = BitMatrix.Load(n,n, src.Current.ToBytes());
         for(var i=0; i<8; i++)
         for(var j=0; j<8; j++)
             Claim.eq(m1[i,j], m2[i,j]);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Defines a binary polynomial of natural degree N = 8
 /// </summary>
 /// <param name="degree">The degree of the polynomial</param>
 /// <param name="exponents">The exponent values for nonzero coefficients</param>
 public static GfPoly <N8, ushort> Poly(N8 degree, params byte[] exponents)
 => Poly <N8, ushort>(exponents);
Esempio n. 3
0
 public static BitVector8 BitVector(this IPolyrand random, N8 n)
 => random.Next <byte>();
Esempio n. 4
0
 public static BitBlock <BitBlock8> ToBitBlock(this BitString src, N8 n)
 => BitBlock.FromSpan <BitBlock8>(src.BitSeq);
Esempio n. 5
0
 public static BitVector8 ToBitVector(this BitString src, N8 n)
 => BitVector8.FromBitString(src);
Esempio n. 6
0
 public static BitVector8 ToBitVector(this ushort src, N8 n)
 => (byte)src;
Esempio n. 7
0
 public static BitVector8 ToBitVector(this byte src, N8 n)
 => src;
Esempio n. 8
0
 public static BitVector8 ToBitVector(this sbyte src, N8 n)
 => (byte)src;
Esempio n. 9
0
 public static BitMatrix8 BitMatrix(this IPolyrand random, N8 n)
 => Z0.BitMatrix8.From(random.Next <ulong>());