Skip to content

Commit 04f5c91

Browse files
authored
adds toOpenArray for ptr UncheckedArray[T] (#1204)
This `toOpenArray` is required to compile nifreader with Nimony.
1 parent 1c25b6e commit 04f5c91

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/std/system/openarrays.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ proc `==`*[T: Equatable](a, b: openArray[T]): bool =
5050
if a[i] != b[i]: return false
5151
return true
5252
return false
53+
54+
proc toOpenArray*[T](x: ptr UncheckedArray[T]; first, last: int): openArray[T] =
55+
openArray[T](a: cast[ptr UncheckedArray[T]](cast[uint](x) + uint(first * sizeof(T))), len: last - first + 1)

0 commit comments

Comments
 (0)