示例#1
0
        public void EnsureUIntMasksAreCorrectLengths()
        {
            Assert.That(BitPack.UIntMask(0) == 0x0, "A mask of size 0 should be 0x0!");
            Assert.That(BitPack.UIntMask(1) == 0x1, "A mask of size 1 should be 0x1!");
            Assert.That(BitPack.UIntMask(2) == 0x3, "A mask of size 2 should be 0x3!");
            Assert.That(BitPack.UIntMask(4) == 0xF, "A mask of size 4 should be 0xF!");
            Assert.That(BitPack.UIntMask(8) == 0xFF, "A mask of size 8 should be 0xFF!");

            Assert.That(BitPack.UIntMask(12) == 0xFFF, "A mask of size 12 should be 0xFFF!");
            Assert.That(BitPack.UIntMask(16) == 0xFFFF, "A mask of size 16 should be 0xFFFF!");

            Assert.That(BitPack.UIntMask(20) == 0xF_FFFF, "A mask of size 20 should be 0xF_FFFF!");
            Assert.That(BitPack.UIntMask(24) == 0xFF_FFFF, "A mask of size 24 should be 0xFF_FFFF!");
            Assert.That(BitPack.UIntMask(28) == 0xFFF_FFFF, "A mask of size 28 should be 0xFFF_FFFF!");
            Assert.That(BitPack.UIntMask(32) == 0xFFFF_FFFF, "A mask of size 32 should be 0xFFFF_FFFF");
        }