Fixes #4946
This commit is contained in:
parent
60d13c488d
commit
7476e4fcb2
1 changed files with 1 additions and 0 deletions
|
|
@ -949,6 +949,7 @@ proc inc*[A](t: var CountTable[A], key: A, val = 1) =
|
||||||
var index = rawGet(t, key)
|
var index = rawGet(t, key)
|
||||||
if index >= 0:
|
if index >= 0:
|
||||||
inc(t.data[index].val, val)
|
inc(t.data[index].val, val)
|
||||||
|
if t.data[index].val == 0: dec(t.counter)
|
||||||
else:
|
else:
|
||||||
if mustRehash(len(t.data), t.counter): enlarge(t)
|
if mustRehash(len(t.data), t.counter): enlarge(t)
|
||||||
rawInsert(t, t.data, key, val)
|
rawInsert(t, t.data, key, val)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue