* fix #13496 handle tombstones * add test * more tests * fix #13504; add SharedTable tests * fix #https://github.com/nim-lang/Nim/issues/13505 intsets.missingOrExcl silently gave wrong results sometimes * add test for tintsets
This commit is contained in:
parent
9a93f73983
commit
42dad3a836
9 changed files with 296 additions and 41 deletions
|
|
@ -107,13 +107,23 @@ template clearImpl() {.dirty.} =
|
|||
t.data[i].val = default(type(t.data[i].val))
|
||||
t.counter = 0
|
||||
|
||||
template ctAnd(a, b): bool =
|
||||
# pending https://github.com/nim-lang/Nim/issues/13502
|
||||
when a:
|
||||
when b: true
|
||||
else: false
|
||||
else: false
|
||||
|
||||
template initImpl(result: typed, size: int) =
|
||||
assert isPowerOfTwo(size)
|
||||
result.counter = 0
|
||||
newSeq(result.data, size)
|
||||
when compiles(result.first):
|
||||
result.first = -1
|
||||
result.last = -1
|
||||
when ctAnd(declared(SharedTable), type(result) is SharedTable):
|
||||
init(result, size)
|
||||
else:
|
||||
assert isPowerOfTwo(size)
|
||||
result.counter = 0
|
||||
newSeq(result.data, size)
|
||||
when compiles(result.first):
|
||||
result.first = -1
|
||||
result.last = -1
|
||||
|
||||
template insertImpl() = # for CountTable
|
||||
checkIfInitialized()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue