Can't find function like memset, and Can't use c_memset, Because It's not publish.
Who can tell me, Thanks.
Ok I 'll add it, Thank you.
But I think nim must add a function instead memset (setMem?), Everyone maybe want it when he dev graphics app.
var pixels: array[255, uint32]
#when you want set all pixel is red color (0xFF).
Modern compilers generally recognize this case and automatically convert a simple loop into a memset.
For example, the following code
type IntArray = array[0..255, int32]
var a: IntArray
proc fill(x: var IntArray) =
for i in low(x)..high(x):
x[i] = -1
fill(a)
gets compiled to the following assembly language code on my machine (using either a recent version of clang or gcc as the backend):
0x0000000100005c90 <fill_94015+0>: push %rbp
0x0000000100005c91 <fill_94015+1>: mov %rsp,%rbp
0x0000000100005c94 <fill_94015+4>: mov $0xff,%esi
0x0000000100005c99 <fill_94015+9>: mov $0x400,%edx
0x0000000100005c9e <fill_94015+14>: callq 0x100005e1c <dyld_stub_memset>
0x0000000100005ca3 <fill_94015+19>: pop %rbp
0x0000000100005ca4 <fill_94015+20>: retq