Skip to content

Commit 946eb57

Browse files
committed
fixup
1 parent 2196b55 commit 946eb57

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/fusion/pointers.nim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ proc toUncheckedArray*[T](a: ptr T): ptr UncheckedArray[T] {.inline.} =
1717
cast[ptr UncheckedArray[T]](a)
1818

1919
template `+`*[T](p: ptr T, off: int): ptr T =
20+
## Unsafe.
2021
runnableExamples:
2122
var a = @[10, 11, 12]
2223
let pa = a[0].addr
@@ -28,18 +29,23 @@ template `+`*[T](p: ptr T, off: int): ptr T =
2829
cast[ptr T](cast[ByteAddress](p) +% off * sizeof(T))
2930

3031
template `-`*[T](p: ptr T, off: int): ptr T =
32+
## Unsafe.
3133
type T = typeof(p[])
3234
cast[ptr T](cast[ByteAddress](p) -% off * sizeof(T))
3335

3436
template `[]`*[T](p: ptr T, off: int): T =
37+
## Unsafe.
3538
(p + off)[]
3639

3740
template `[]=`*[T](p: ptr T, off: int, val: T) =
41+
## Unsafe.
3842
(p + off)[] = val
3943

4044
proc `+=`*[T](p: var ptr T, off: int) {.inline.} =
45+
## Unsafe.
4146
# not a template to avoid double evaluation issues
4247
p = p + off
4348

4449
proc `-=`*[T](p: var ptr T, off: int) {.inline.} =
50+
## Unsafe.
4551
p = p - off

0 commit comments

Comments
 (0)