示例#1
0
        static void InitializeBitmaskLookUpTable(out TWord[] table)
        {
            bool success = Bits.GetBitConstants(typeof(TWord),
                                                out int word_byte_count, out int word_bit_count, out int word_bit_shift, out int word_bit_mod);

            Contract.Assert(success, "TWord is an invalid type for BitStream");

            Bits.BitmaskLookUpTableGenerate(kWordBitCount, out table);
        }
示例#2
0
        public void Bits_TestBitmaskLookUpTableGenerators()
        {
            Bits.BitmaskLookUpTableGenerate(Bits.kByteBitCount, out byte[] generated8);
            Assert.IsTrue(generated8.EqualsArray(kBitmaskLookup8));

            Bits.BitmaskLookUpTableGenerate(Bits.kInt16BitCount, out ushort[] generated16);
            Assert.IsTrue(generated16.EqualsArray(kBitmaskLookup16));

            Bits.BitmaskLookUpTableGenerate(Bits.kInt32BitCount, out uint[] generated32);
            Assert.IsTrue(generated32.EqualsArray(kBitmaskLookup32));

            Bits.BitmaskLookUpTableGenerate(Bits.kInt64BitCount, out ulong[] generated64);
            Assert.IsTrue(generated64.EqualsArray(kBitmaskLookup64));
        }