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
Method hash(...) gets the hash code from the key and applies bitmask to prevent zero hash code. It ORs the actual hashcode with 0b1100_0000_0000_0001
protectedvirtualinthash(TKeykey){Debug.Assert(!(keyisnull));inth=_keyComparer.GetHashCode(key);// ensure that hash never matches 0, TOMBPRIMEHASH, ZEROHASH or REGULAR_HASH_BITSreturnh|(SPECIAL_HASH_BITS|1);}
The problem is if two objects have two consecutive hash codes, they will end up with the same hash:
Method hash(...) gets the hash code from the key and applies bitmask to prevent zero hash code. It ORs the actual hashcode with 0b1100_0000_0000_0001
The problem is if two objects have two consecutive hash codes, they will end up with the same hash:
0xXXX0 -> 0xXXX1
0xXXX1 -> 0xXXX1
0xXXX2 -> 0xXXX3
0xXXX3 -> 0xXXX3
0xXXX4 -> 0xXXX5
0xXXX5 -> 0xXXX5
0xXXX6 -> 0xXXX7
0xXXX7 -> 0xXXX7
etc.
The text was updated successfully, but these errors were encountered: