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]); } }
public void bm_and_8x8_check() { for (var i = 0; i < SampleSize; i++) { var A = Random.BitMatrix(n8); var B = Random.BitMatrix(n8); var xBytes = A.Bytes.Replicate(); var yBytes = B.Bytes.Replicate(); var zBytes = gbitspan.and(xBytes, yBytes); var expect = BitMatrix8.From(zBytes); var C = A & B; Claim.yea(expect == C); } }
public static BitMatrix8 and(BitMatrix8 lhs, BitMatrix8 rhs) => BitMatrix8.From((ulong)lhs & (ulong)rhs);