Skip to content

Commit

Permalink
replace shallowCopy with move in ARC/ORC (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Jul 25, 2022
1 parent dcbd7c6 commit f621e01
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/arraymancer/laser/tensor/initialization.nim
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ proc toTensor*(a: openarray, dummy_bugfix: static[int] = 0): auto =
## Note: dummy_bugfix param is unused and is a workaround a Nim bug.
# TODO: remove 'dummy_bugfix' - https://github.com/nim-lang/Nim/issues/6343

let
shape = getShape(a)
data = toSeq(flatIter(a))
let shape = getShape(a)
var data = toSeq(flatIter(a))

if unlikely(shape.product != data.len):
raise newException(
Expand All @@ -229,7 +228,10 @@ proc toTensor*(a: openarray, dummy_bugfix: static[int] = 0): auto =
when T is KnownSupportsCopyMem:
t.copyFromRaw(data[0].unsafeAddr, data.len)
else:
shallowCopy(t.storage.raw_buffer, data)
when defined(gcArc) or defined(gcOrc):
t.storage.raw_buffer = move data
else:
shallowCopy(t.storage.raw_buffer, data)

result = t

Expand Down

0 comments on commit f621e01

Please sign in to comment.