private int InsertNewKey(object key, int hash)
{
if (check && occupiedCount != keyCount)
{
Kit.CodeBug();
}
if (check && keyCount == 1 << power)
{
Kit.CodeBug();
}
int fraction = hash * A;
int index = (int)(((uint)fraction) >> (32 - power));
int N = 1 << power;
if (keys[index] != null)
{
int mask = N - 1;
int step = TableLookupStep(fraction, mask, power);
int firstIndex = index;
do
{
if (check && keys[index] == DELETED)
{
Kit.CodeBug();
}
index = (index + step) & mask;
if (check && firstIndex == index)
{
Kit.CodeBug();
}
}
while (keys[index] != null);
}
keys[index] = key;
values[N + index] = hash;
++occupiedCount;
++keyCount;
return index;
}