nim-ranges/ranges/ptr_arith.nim

6 lines
150 B
Nim
Raw Normal View History

2018-02-16 14:39:44 +00:00
proc baseAddr*[T](x: openarray[T]): pointer = cast[pointer](x)
proc shift*(p: pointer, delta: int): pointer =
cast[pointer](cast[int](p) + delta)