diff options
Diffstat (limited to 'src/ptrmath.nim')
-rw-r--r-- | src/ptrmath.nim | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/ptrmath.nim b/src/ptrmath.nim deleted file mode 100644 index 7de2fa6..0000000 --- a/src/ptrmath.nim +++ /dev/null @@ -1,19 +0,0 @@ -# from http://forum.nim-lang.org/t/1188#7366 - -template `+`*[T](p: ptr T, off: int): ptr T = - cast[ptr type(p[])](cast[ByteAddress](p) +% off * sizeof(p[])) - -template `+=`*[T](p: ptr T, off: int) = - p = p + off - -template `-`*[T](p: ptr T, off: int): ptr T = - cast[ptr type(p[])](cast[ByteAddress](p) -% off * sizeof(p[])) - -template `-=`*[T](p: ptr T, off: int) = - p = p - off - -template `[]`*[T](p: ptr T, off: int): T = - (p + off)[] - -template `[]=`*[T](p: ptr T, off: int, val: T) = - (p + off)[] = val
\ No newline at end of file |