private int Insert(long value) { Debug.Assert(count <= values.Length); lastSurrogate = store.NextFreeIdx(lastSurrogate); int hashcode = Hashcode(value); if (count == values.Length) { Resize(); } values[count] = value; surrogates[count] = lastSurrogate; if (count >= 16) { if (count >= hashRange) { if (hashRange != 0) { Array.Fill(hashtable, hashRange, -1); hashRange *= 2; } else { hashRange = 16; } for (int i = 0; i < count; i++) { InsertIntoHashtable(i, Hashcode(values[i])); } } InsertIntoHashtable(count, hashcode); } count++; return(lastSurrogate); }