mirror of
https://github.com/status-im/nim-ranges.git
synced 2025-01-13 06:14:39 +00:00
8 lines
276 B
Nim
8 lines
276 B
Nim
proc baseAddr*[T](x: openarray[T]): pointer = cast[pointer](x)
|
|
|
|
proc shift*(p: pointer, delta: int): pointer {.inline.} =
|
|
cast[pointer](cast[int](p) + delta)
|
|
|
|
proc shift*[T](p: ptr T, delta: int): ptr T {.inline.} =
|
|
cast[ptr T](shift(cast[pointer](p), delta * sizeof(T)))
|