public void bitblock32_spans() { var x = BitBlock32.Alloc(); x.Bit0 = 1; x.Bit5 = 1; x.Bit19 = 1; var y = BitBlock.AsSpan(ref x); Claim.eq(y[0], x.Bit0); Claim.eq(y[5], x.Bit19); Claim.eq(x[0], (byte)1); Claim.eq(x[5], (byte)1); Claim.eq(x[19], (byte)1); for (var i = 0; i < SampleSize; i++) { var src = Random.Span <byte>(Pow2.T05); var dstBlock = BitBlock32.FromSpan(src); for (var j = 0; j < src.Length; j++) { Claim.eq(src[j], dstBlock[j]); } var dstSpan = BitBlock.AsSpan(ref dstBlock); for (var j = 0; j < dstSpan.Length; j++) { Bits.toggle(ref dstSpan[j], 0); Claim.neq(dstBlock[j], src[j]); } } }
public uint ToUInt32() => BitBlock.AsSpan(ref this).TakeUInt32();
public static Span <byte> part32x1(uint src) { BitBlock32 block = default; return(BitBlock.AsSpan(ref part32x1(src, ref block))); }
public ulong ToUInt64() => BitBlock.AsSpan(ref this).TakeUInt64();