fixes hash(HashSet) which was wrong as it didn't respect tombstones; refs #13649
This commit is contained in:
parent
5f6997794e
commit
3f1a85b7f0
1 changed files with 2 additions and 1 deletions
|
|
@ -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 =
|
proc hash*[A](s: HashSet[A]): Hash =
|
||||||
## Hashing of HashSet.
|
## Hashing of HashSet.
|
||||||
for h in 0 .. high(s.data):
|
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
|
result = !$result
|
||||||
|
|
||||||
proc `$`*[A](s: HashSet[A]): string =
|
proc `$`*[A](s: HashSet[A]): string =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue