コード例 #1
0
        public void bs_bitview()
        {
            var x  = Random.CpuVec256 <int>();
            var y  = BitView.ViewBits(ref x);
            var ys = y.Bytes.ToBitString();
            var xs = x.ToBitString();

            Claim.eq(ys, xs);
        }
コード例 #2
0
        public void VerifyPrimalView()
        {
            var src  = UInt64.MaxValue;
            var len  = sizeof(ulong);
            var view = BitView.ViewBits(ref src);

            for (var i = 0; i < len; i++)
            {
                for (byte j = 0; j < 8; j++)
                {
                    view[i, j] = j % 2 == 0;
                }
            }

            var bs = src.ToBitString();

            for (var i = 0; i < len * 8; i++)
            {
                Claim.yea(bs[i] == (i % 2 == 0));
            }
        }