fix orderedtable enlarge proc. (#5937)

This fixes issue #5917
This commit is contained in:
Parashurama 2017-06-05 13:16:30 +02:00 • committed by Andreas Rumpf
commit cd51628f57
2 changed files with 23 additions and 2 deletions

View file

@ -590,8 +590,11 @@ proc enlarge[A, B](t: var OrderedTable[A, B]) =
swap(t.data, n)
while h >= 0:
var nxt = n[h].next
if isFilled(n[h].hcode):
var j = -1 - rawGetKnownHC(t, n[h].key, n[h].hcode)
let eh = n[h].hcode
if isFilled(eh):
var j: Hash = eh and maxHash(t)
while isFilled(t.data[j].hcode):
j = nextTry(j, maxHash(t))
rawInsert(t, t.data, n[h].key, n[h].val, n[h].hcode, j)
h = nxt