This commit is contained in:
Felix Krause 2016-10-24 22:32:38 +02:00
commit 7476e4fcb2

View file

@ -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)