You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If a matching key is found, update the entry's value and return the old value.
352
-
if(_comparer.Equals(entry.Key,key))
350
+
if(_hasher.Equals(entry.Key,key))
353
351
{
354
352
entry.Value=value;
355
353
return;
@@ -445,7 +443,7 @@ public bool Get(TKey key, out TValue value)
445
443
// Retrieve the entry corresponding to the matched bit position within the map's entries.
446
444
varentry=Find(_entries,index+(uint)bitPos);
447
445
// Check if the entry's key matches the specified key using the equality comparer.
448
-
if(_comparer.Equals(entry.Key,key))
446
+
if(_hasher.Equals(entry.Key,key))
449
447
{
450
448
// If a match is found, set the output value and return true.
451
449
value=entry.Value;
@@ -529,7 +527,7 @@ public ref TValue GetValueRefOrAddDefault(TKey key)
529
527
// Use `bitPos` to access the corresponding entry in `_entries`.
530
528
refvarentry=refFind(_entries,index+(uint)bitPos);
531
529
// If a matching key is found, update the entry's value and return the old value.
532
-
if(_comparer.Equals(entry.Key,key))
530
+
if(_hasher.Equals(entry.Key,key))
533
531
{
534
532
returnrefentry.Value;
535
533
}
@@ -625,7 +623,7 @@ public bool Update(TKey key, TValue value)
625
623
refvarentry=refFind(_entries,index+(uint)bitPos);
626
624
627
625
// Check if the current entry's key matches the specified key using the equality comparer.
628
-
if(_comparer.Equals(entry.Key,key))
626
+
if(_hasher.Equals(entry.Key,key))
629
627
{
630
628
// If a match is found, update the entry's value and return `true` to indicate success.
631
629
entry.Value=value;
@@ -708,8 +706,8 @@ public bool Remove(TKey key)
708
706
vari=index+(uint)bitPos;
709
707
710
708
// Check if the entry at the matched position has a key that equals the specified key.
711
-
// Use `_comparer` to ensure accurate key comparison.
712
-
if(_comparer.Equals(Find(_entries,i).Key,key))
709
+
// Use `_hasher` to ensure accurate key comparison.
710
+
if(_hasher.Equals(Find(_entries,i).Key,key))
713
711
{
714
712
// If the group that contains the entry to be removed has an empty slot (an unoccupied slot that is marked empty rather than as a tombstone), this indicates that any probe sequence for a key would terminate upon reaching that empty slot.
715
713
// Since probe sequences terminate at the first empty slot they encounter, having an empty slot in the group means that removing the current entry without placing a tombstone won’t disrupt probe chains.
@@ -807,8 +805,8 @@ public bool Contains(TKey key)
807
805
// Get the position of the first set bit in `mask`, indicating a potential key match.
808
806
varbitPos=BitOperations.TrailingZeroCount(mask);
809
807
// Check if the entry at this position has a key that matches the specified key.
810
-
// Use `_comparer` to ensure accurate key comparison.
0 commit comments