Ah, thank you that is what I was afraid of/experiencing, should I do it like
below?
func sieve* (n:int, a:var seq[int]): int {.cdecl, exportc: "sievenim",
dynlib.}=
a.add(2)
#let a_ptr =a[0].unsafeAddr
var arr = newSeq[bool](n+1)
for x in countup(3,n,2):
if not(arr[x]):
a.add(x)
for y in countup(x*x,n,x):
arr[y] = true
result = ( a.len)
Run
- Memory layout of a seq[int] lux
- Re: Memory layout of a seq[int] mratsim
- Re: Memory layout of a seq[int] lux
- Re: Memory layout of a seq[int] mratsim
- Re: Memory layout of a seq[int] lux
