pragma on/off improvements; endb rewritten

This commit is contained in:
Araq 2012-01-28 23:22:44 +01:00
commit 8d19a93f1a
23 changed files with 517 additions and 202 deletions

View file

@ -35,12 +35,14 @@ proc reverse*[T](a: var openArray[T]) =
reverse(a, 0, a.high)
const
onlySafeCode = false
onlySafeCode = true
proc merge[T](a, b: var openArray[T], lo, m, hi: int,
cmp: proc (x, y: T): int, order: TSortOrder) =
template `<-` (a, b: expr) =
when onlySafeCode:
when true:
a = b
elif onlySafeCode:
shallowCopy(a, b)
else:
copyMem(addr(a), addr(b), sizeof(T))