Skip to content

Commit

Permalink
redo {} properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Clonkk committed Jun 16, 2024
1 parent 71bcc31 commit baadb06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/numpyarrays/examply.nim
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ proc parallelIndexedForOp*(x: NumpyArray[float64]) : NumpyArray[float64] {.expor
result = initNumpyArray[float64](x.shape)

fuseLoops("parallel for"):
for i in 0..(x.shape[0]-1):
for j in 0..(x.shape[1]-1):
for i in 0..<x.shape[0]:
for j in 0..<x.shape[1]:
result[i, j] = doStuff x[i, j]

proc normalForOp*(x: NumpyArray[float64]) : NumpyArray[float64] {.exportpy.} =
Expand Down
4 changes: 2 additions & 2 deletions scinim/numpyarrays.nim
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ template `[]=`*[T](ndArray: NumpyArray[T], idx: varargs[int], val: T) =

# Is this worth it ?
template `{}`*[T](ndArray: NumpyArray[T], idx: int): T =
atContiguousIndex(ndArray, idx)
toUnsafeView(ndArray)[idx]

template `{}=`*[T](ndArray: NumpyArray[T], idx: int, val: T) =
atContiguousIndex(ndArray, idx) = val
toUnsafeView(ndArray)[idx] = val

{.pop.}
{.pop.}

0 comments on commit baadb06

Please sign in to comment.