optimizes setLen for orc; disabling ranging checks

This commit is contained in:
ringabout
2026-04-09 10:09:28 +08:00
parent 115ec7a433
commit d914a7a81a

View File

@@ -262,8 +262,11 @@ proc setLen[T](s: var seq[T], newlen: Natural) {.nodestroy.} =
if xu.p == nil or (xu.p.cap and not strlitFlag) < newlen:
xu.p = cast[typeof(xu.p)](prepareSeqAddUninit(oldLen, xu.p, newlen - oldLen, sizeof(T), alignof(T)))
xu.len = newlen
{.push overflowChecks: off.}
for i in oldLen..<newlen:
xu.p.data[i] = default(T)
{.pop.}
proc newSeq[T](s: var seq[T], len: Natural) =
shrink(s, 0)