Example #1
0
        internal void Load(Stream s)
        {
            s.AssumeNotNull();
            Reserved0 = s.ReadUIntLE();
            MajorVersion = s.ReadByteOrThrow();
            MinorVersion = s.ReadByteOrThrow();
            m_heapSizes = s.ReadByteOrThrow();
            Reserved1 = s.ReadByteOrThrow();
            ValidTables = s.ReadULongLE();

            Util.Assume(
                (ValidTables & ~s_validTableMask) == 0,
                "Unknown table specified in ValidTables mask"
            );

            SortedTables = s.ReadULongLE();

            var numberOfTables = ValidTables.NumberOfSetBits();

            Util.Assume((ValidTables & ~((1UL << (int)TableID.MAX_TABLE_ID) - 1)) == 0UL, "Unrecogonized meta-data table detected");
            Util.Assume(numberOfTables >= 1, "Too fiew meta-data tables");

            var rowCounts = new uint[numberOfTables];

            for (int i = 0; i < numberOfTables; ++i)
            {
                rowCounts[i] = s.ReadUIntLE();
            }

            RowCounts = new ReadOnlyCollection<uint>(rowCounts);
        }