private static uint GetIndexSize(CodedIndex codedIndex, MetadataTableInfo[] tables) { uint maxRowCount = 0; for (int i = 0; i < codedIndex.TableCount; ++i) { var table = codedIndex.GetTable(i); if (table.HasValue) { var rowCount = tables[(int)table.Value].RowCount; if (rowCount > maxRowCount) { maxRowCount = rowCount; } } } int valueBitCount = 16 - codedIndex.TagBitCount; return(maxRowCount < (1U << valueBitCount) ? 2U : 4U); }