示例#1
0
 public static uint GetSize(CodedIndexType type, uint[] numberOfTableRow)
 {
     if (codedIndexTypes.ContainsKey(type) && codedIndexBits.ContainsKey(type))
     {
         CorTokenType[] tokens = codedIndexTypes[type];
         uint           v      = 0x01;
         int            bits   = codedIndexBits[type];
         v <<= 16 - bits;
         uint size = 0;
         foreach (CorTokenType token in tokens)
         {
             int  ix    = (int)token;
             uint tsize = numberOfTableRow[ix];
             if (tsize > size)
             {
                 size = tsize;
             }
         }
         if (size >= v)
         {
             return(4);
         }
         else
         {
             return(2);
         }
     }
     return(0);
 }
        public bool use4ByteIndex(CodedIndexType iType)
        {
            int[] tables = (int[])this.CodedIndexInformation[(int)iType];
            //the first element is the number of bits required to encode this index type
            int numOfBits = tables[0];
            int maxValueForRemainingBits = 65535;

            maxValueForRemainingBits = 65535 >> numOfBits;

            // Now loop through each relevant table and see if any of them have more rows
            // than the figure we just calculated.
            uint maxRows = 0;

            for (int i = 1; i < tables.Length; i++)
            {
                if (this.RowsPerTable[tables[i]] > maxRows)
                {
                    maxRows = this.RowsPerTable[tables[i]];
                }
            }

            return(maxRows > maxValueForRemainingBits);
        }
示例#3
0
 public uint GetCodedIndexSize(CodedIndexType type)
 {
     return(CodedIndexSize.GetSize(type, NumberOfTableRow));
 }