mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-20 16:01:29 +00:00
fixes hash(HashSet) which was wrong as it didn't respect tombstones; refs #13649
This commit is contained in:
@@ -574,7 +574,8 @@ proc map*[A, B](data: HashSet[A], op: proc (x: A): B {.closure.}): HashSet[B] =
|
||||
proc hash*[A](s: HashSet[A]): Hash =
|
||||
## Hashing of HashSet.
|
||||
for h in 0 .. high(s.data):
|
||||
result = result xor s.data[h].hcode
|
||||
if isFilledAndValid(s.data[h].hcode):
|
||||
result = result xor s.data[h].hcode
|
||||
result = !$result
|
||||
|
||||
proc `$`*[A](s: HashSet[A]): string =
|
||||
|
||||
Reference in New Issue
Block a user