Can I declare a sequence with 16-byte aligned start address? (SIMD requirement) In C/C++ usually a hack is used to allocate array more that needed and start elements from aligned offset, that would be a nice to have language feature for sequence type.
Or which is a nice way to wrap that feature using existing seq[] type?
This works for me on 32 bit. Should work on 64bit too. So ... it's aligned to 16 bytes due to sheer luck. Which might be good enough for now, the 'seq' implementation is unlikely to change any time soon. In the long term newSeq(s, size, alignment) should be provided.
proc main =
var s: seq[float]
s = @[8.0, 3.0, 2.0]
assert((cast[int](addr(s[0])) and 0b1_0000) == 0b1_0000)
main()