Ejemplo n.º 1
0
        public void CanSetBits()
        {
            var buffer      = stackalloc byte[16];
            var bitsBufffer = new BitsBuffer(buffer, 16);

            bitsBufffer.AddValue(12, 6);
            bitsBufffer.AddValue(3, 7);
            bitsBufffer.AddValue(279, 18);

            bitsBufffer.SetBits(6, 7, 7);

            int index = 0;

            Assert.Equal(12UL, bitsBufffer.ReadValue(ref index, 6));
            Assert.Equal(7UL, bitsBufffer.ReadValue(ref index, 7));
            Assert.Equal(279UL, bitsBufffer.ReadValue(ref index, 18));
        }