Add compute proc for SharedTable (#5385)
This commit is contained in:
parent
e2567e2e03
commit
a81247dcbe
3 changed files with 77 additions and 4 deletions
|
|
@ -120,9 +120,7 @@ template default[T](t: typedesc[T]): T =
|
|||
var v: T
|
||||
v
|
||||
|
||||
template delImpl() {.dirty.} =
|
||||
var hc: Hash
|
||||
var i = rawGet(t, key, hc)
|
||||
template delImplIdx(t, i) =
|
||||
let msk = maxHash(t)
|
||||
if i >= 0:
|
||||
dec(t.counter)
|
||||
|
|
@ -145,6 +143,11 @@ template delImpl() {.dirty.} =
|
|||
else:
|
||||
shallowCopy(t.data[j], t.data[i]) # data[j] will be marked EMPTY next loop
|
||||
|
||||
template delImpl() {.dirty.} =
|
||||
var hc: Hash
|
||||
var i = rawGet(t, key, hc)
|
||||
delImplIdx(t, i)
|
||||
|
||||
template clearImpl() {.dirty.} =
|
||||
for i in 0 .. <t.data.len:
|
||||
when compiles(t.data[i].hcode): # CountTable records don't contain a hcode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue