pointer arithmetic helpers

This commit is contained in:
Zahary Karadjov 2018-02-16 16:39:44 +02:00
parent 9815d9708f
commit ee803f088f
1 changed files with 5 additions and 0 deletions

5
ranges/ptr_arith.nim Normal file
View File

@ -0,0 +1,5 @@
proc baseAddr*[T](x: openarray[T]): pointer = cast[pointer](x)
proc shift*(p: pointer, delta: int): pointer =
cast[pointer](cast[int](p) + delta)