Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ internal sealed class HashLookup<TKey, TValue>
private int[] buckets;
private Slot[] slots;
private int count;
private int freeList;
private readonly IEqualityComparer<TKey>? comparer;

private const int HashCodeMask = 0x7fffffff;
Expand All @@ -36,7 +35,6 @@ internal HashLookup(IEqualityComparer<TKey>? comparer)
this.comparer = comparer;
buckets = new int[7];
slots = new Slot[7];
freeList = -1;
}

// If value is not in set, add it and return true; otherwise return false
Expand Down Expand Up @@ -97,18 +95,10 @@ private bool Find(TKey key, bool add, bool set, [MaybeNullWhen(false)] ref TValu

if (add)
{
int index;
if (freeList >= 0)
{
index = freeList;
freeList = slots[index].next;
}
else
{
if (count == slots.Length) Resize();
index = count;
count++;
}
if (count == slots.Length) Resize();

int index = count;
count++;

int bucket = hashCode % buckets.Length;
slots[index].hashCode = hashCode;
Expand Down
Loading