Пример #1
0
 public void Clear()
 {
     for (int x = 0; x < size; x++)
     {
         tabledata[x] = new TTHashEntry();
     }
 }
Пример #2
0
        public bool Lookup(UInt64 hashcode, ref TTHashEntry hash)
        {
            long groupStart = (long)hashcode & (size - 1) & 0xFFFFFFFCL;

            for (int slot = 0; slot < 4; slot++)
            {
                if (tabledata[groupStart + slot].CheckHash(hashcode))
                {
                    hash = tabledata[groupStart + slot];
                    return(true);
                }
            }
            return(false);
        }
Пример #3
0
        protected bool allocate(int size)
        {
            int arraySize = size * 4;

            try
            {
                tabledata = new TTHashEntry[arraySize];
            }
            catch (OutOfMemoryException ex)
            {
                return(false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            this.size = arraySize;
            return(true);
        }