Exemplo n.º 1
0
 public int GetHashCode(ref KeySegment <E, T> obj, bool objIsWeak)
 {
     return((int)Hasher.Rehash(_elementComparer.GetHashCode(ref obj._elementReference, objIsWeak)) ^ _tail.GetHashCode(ref obj._tail, objIsWeak));
 }
Exemplo n.º 2
0
 protected internal override uint GetKeyHashCode(ref TKey key)
 {
     return(Hasher.Rehash(_KeyComparer.GetHashCode(key)));
 }
Exemplo n.º 3
0
 public int CalculateHashCode(K obj)
 {
     return((int)Hasher.Rehash(_comparers.GetHashCode(ref obj._values, obj.IsWeak)) ^ _strongValueComparer.GetHashCode(obj._strongValue));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Get a hashcode for given search key.
 /// </summary>
 /// <param name="key">Reference to the key to get a hash value for.</param>
 /// <returns>The hash value as an <see cref="UInt32"/>.</returns>
 /// <remarks>
 /// The hash returned should be properly randomized hash. The standard GetItemHashCode methods are usually not good enough.
 /// A storeable item and a matching search key should return the same hash code.
 /// So the statement <code>ItemEqualsItem(storeableItem, searchKey) ? GetItemHashCode(storeableItem) == GetItemHashCode(searchKey) : true </code> should always be true;
 /// </remarks>
 internal protected override UInt32 GetKeyHashCode(ref ConcurrentDictionaryKey <TKey, TValue> key)
 {
     return(Hasher.Rehash(_Comparer.GetHashCode(key._Key)));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Get a hashcode for given storeable item.
 /// </summary>
 /// <param name="item">Reference to the item to get a hash value for.</param>
 /// <returns>The hash value as an <see cref="UInt32"/>.</returns>
 /// <remarks>
 /// The hash returned should be properly randomized hash. The standard GetItemHashCode methods are usually not good enough.
 /// A storeable item and a matching search key should return the same hash code.
 /// So the statement <code>ItemEqualsItem(storeableItem, searchKey) ? GetItemHashCode(storeableItem) == GetItemHashCode(searchKey) : true </code> should always be true;
 /// </remarks>
 internal protected override UInt32 GetItemHashCode(ref KeyValuePair <TKey, TValue>?item)
 {
     return(item.HasValue ? Hasher.Rehash(_Comparer.GetHashCode(item.Value.Key)) : 0);
 }
 internal protected override UInt32 GetKeyHashCode(ref int key)
 {
     return(Hasher.Rehash(_Comparer.GetHashCode(key)));
     //return key;
 }
 internal protected override UInt32 GetItemHashCode(ref KeyValuePair <int, string>?item)
 {
     return(item.HasValue ? Hasher.Rehash(_Comparer.GetHashCode(item.Value.Key)) : 0);
     //return item.HasValue ? item.Value.Key : 0;
 }
 UInt32 GetHashCode(TKey key)
 {
     return(Hasher.Rehash(_Comparer.GetHashCode(key)));
 }