mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-21 09:27:59 +02:00
Fixes for large strings, multiple 'opposite' operators
This commit is contained in:
parent
1346e241db
commit
f266fe69d1
8 changed files with 110 additions and 34 deletions
|
@ -196,6 +196,24 @@ namespace System.Collections.Generic
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool ContainsWith<TAltKey>(TAltKey item) where TAltKey : IOpEquals<T>, IHashable
|
||||
{
|
||||
if (mBuckets != null)
|
||||
{
|
||||
int32 hashCode = (int32)item.GetHashCode() & Lower31BitMask;
|
||||
// see note at "HashSet" level describing why "- 1" appears in for loop
|
||||
for (int32 i = mBuckets[hashCode % mBuckets.Count] - 1; i >= 0; i = mSlots[i].mNext)
|
||||
{
|
||||
if (mSlots[i].mHashCode == hashCode && /*m_comparer.Equals*/(mSlots[i].mValue == item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// either m_buckets is null or wasn't found
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Copy items in this hashset to array, starting at arrayIndex
|
||||
/// @param array array to add items to
|
||||
/// @param arrayIndex index to start at
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue