示例#1
0
        public void ShouldSetBit(int index, byte[] leftBits, byte[] expectedResult)
        {
            dba.SetLeftBits(leftBits, 0, 0, leftBits.Length * 8);
            dba.SetBit(index);
            var actualResult = dba.ToByteArray();

            Assert.That(actualResult, Is.EqualTo(expectedResult));
        }
示例#2
0
        /// <summary>
        /// Gets the mask of bits that have (yet) to have valid data.
        /// </summary>
        public IReadOnlyDuoBitArray GetMaskOfUnusedBits()
        {
            var invertedMask = duoBitArrayUtilities.GetInvertedBytes(mask.ToByteArray());

            var maskOfUnusedBits = DuoBitArray.Create(Capacity, duoBitArrayUtilities)
                                   .SetLeftBits(invertedMask,
                                                sourceArrayBitIndex: 0,
                                                destinationBitIndex: 0,
                                                numBits: mask.Capacity);

            return(maskOfUnusedBits);
        }
示例#3
0
 /// <summary>
 /// Converts the underlying data structure into an array of bytes; the underlying data structure has both
 /// the "left" and the "right" bit arrays.
 /// </summary>
 public byte[] ToByteArray() => duoBitArray.ToByteArray();