Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom newSeqUninit if available in stdlib #592

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/arraymancer/private/sequninit.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# from Nim https://github.com/nim-lang/Nim/pull/22739 on the stdlib provides a
# `newSeqUninit` for types supporting `supportsCopyMem`
when not declared(newSeqUninit):
# https://github.com/nim-lang/Nim/pull/22586#issuecomment-1698160304

func newSeqUninit*[T](len: Natural): seq[T] {.inline.} =
## Creates an uninitialzed seq.
## Contrary to newSequnitialized in system.nim this works for any subtype T
Expand Down
2 changes: 1 addition & 1 deletion src/arraymancer/tensor/exporting.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ proc toRawSeq*[T](t:Tensor[T]): seq[T] {.noSideEffect, deprecated: "This proc ca
# Due to forward declaration this proc must be declared
# after "cpu" proc are declared in init_cuda
when t is Tensor:
result = newSeqUninit[T](t.size)
result = newSeq[T](t.size)
for i in 0 ..< t.size:
when T is KnownSupportsCopyMem:
result[i] = t.unsafe_raw_offset()[i]
Expand Down