* fix #20997 calling system.card[T](x: set[T]) with T of int8 or uint8 uses mismatched C array sizes * fullfil set variant
This commit is contained in:
parent
ca9c74391a
commit
0b319fee3d
3 changed files with 24 additions and 4 deletions
|
|
@ -10,10 +10,9 @@
|
|||
# set handling
|
||||
|
||||
type
|
||||
NimSet = array[0..4*2048-1, uint8]
|
||||
NimSet = array[0..8192-1, uint8]
|
||||
|
||||
|
||||
proc cardSet(s: NimSet, len: int): int {.compilerproc, inline.} =
|
||||
proc cardSetImpl(s: openArray[uint8], len: int): int {.inline.} =
|
||||
var i = 0
|
||||
result = 0
|
||||
when defined(x86) or defined(amd64):
|
||||
|
|
@ -24,3 +23,6 @@ proc cardSet(s: NimSet, len: int): int {.compilerproc, inline.} =
|
|||
while i < len:
|
||||
inc(result, countBits32(uint32(s[i])))
|
||||
inc(i, 1)
|
||||
|
||||
proc cardSet(s: NimSet, len: int): int {.compilerproc, inline.} =
|
||||
result = cardSetImpl(s, len)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue