Skip to content

Commit

Permalink
Remove method from quadmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Wsm2110 committed Apr 14, 2024
1 parent 0f2fc78 commit 65ec512
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Faster.Map.QuadMap/QuadMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public QuadMap(uint length, double loadFactor, IEqualityComparer<TKey> keyCompar
public bool Emplace(TKey key, TValue value)
{
//Resize if loadfactor is reached
if (Count >= _maxLookupsBeforeResize)
if (Count > _maxLookupsBeforeResize)
{
Resize();
}
Expand All @@ -195,7 +195,7 @@ public bool Emplace(TKey key, TValue value)
do
{
//retrieve infobyte
ref var entry = ref FindValueRef(_entries, index);
ref var entry = ref Find(_entries, index);

//Empty spot, add entry
if (entry.Metadata == _emptyBucket || entry.Metadata == _tombstone)
Expand Down Expand Up @@ -243,7 +243,7 @@ public ref TValue GetOrUpdate(TKey key)
do
{
//retrieve infobyte
ref var entry = ref FindValueRef(_entries, index);
ref var entry = ref Find(_entries, index);

//Empty spot, add entry
if (entry.Metadata == _emptyBucket || entry.Metadata == _tombstone)
Expand Down Expand Up @@ -359,7 +359,7 @@ public bool Get(TKey key, out TValue value)
while (true)
{
//retrieve entry
ref var entry = ref FindValueRef(_entries, index);
ref var entry = ref Find(_entries, index);

if (h2 == entry.Metadata && _comparer.Equals(key, entry.Key))
{
Expand Down Expand Up @@ -398,7 +398,7 @@ public bool Update(TKey key, TValue value)

do
{
ref var entry = ref FindValueRef(_entries, index);
ref var entry = ref Find(_entries, index);

if (h2 == entry.Metadata && _comparer.Equals(key, entry.Key))
{
Expand Down Expand Up @@ -437,7 +437,7 @@ public bool Remove(TKey key)

do
{
ref var entry = ref FindValueRef(_entries, index);
ref var entry = ref Find(_entries, index);

if (h2 == entry.Metadata && _comparer.Equals(key, entry.Key))
{
Expand Down Expand Up @@ -479,7 +479,7 @@ public bool Contains(TKey key)

do
{
ref var entry = ref FindValueRef(_entries, index);
ref var entry = ref Find(_entries, index);

if (h2 == entry.Metadata && _comparer.Equals(key, entry.Key))
{
Expand Down Expand Up @@ -584,7 +584,7 @@ private void EmplaceInternal(TKey key, TValue value)
do
{
//retrieve infobyte
ref var entry = ref FindValueRef(_entries, index);
ref var entry = ref Find(_entries, index);

//Empty spot, add entry
if (entry.Metadata == _emptyBucket)
Expand Down Expand Up @@ -624,7 +624,7 @@ private void Resize()

for (uint i = 0; i < oldEntries.Length; ++i)
{
ref var entry = ref FindValueRef(oldEntries, i);
ref var entry = ref Find(oldEntries, i);
if (entry.Metadata < 0)
{
continue;
Expand All @@ -635,7 +635,7 @@ private void Resize()
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static ref T FindValueRef<T>(T[] array, uint index)
private static ref T Find<T>(T[] array, uint index)
{
ref var arr0 = ref MemoryMarshal.GetArrayDataReference(array);
return ref Unsafe.Add(ref arr0, index);
Expand Down

0 comments on commit 65ec512

Please sign in to comment.