Skip to content

Commit

Permalink
Changed rem to mod to prevent 0 or negative index. (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbwuzhe authored Jul 23, 2024
1 parent ae7cb0a commit 4c9dbce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/convolution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ quote

@nloops_ $(D-1) (d->l_{d+1}) (d -> 1:size(block,d+1)) d->begin
# preexpr
idx_{d+1} = ( rem(l_{d+1} + off[d+1] + p.Ñ[d+1], p.Ñ[d+1]) + 1)
idx_{d+1} = ( mod(l_{d+1} + off[d+1] + p.Ñ[d+1], p.Ñ[d+1]) + 1)
end begin
# bodyexpr
@inbounds @simd for l_1 = 1:LA
Expand Down Expand Up @@ -305,7 +305,7 @@ end

@nloops_ $(D-1) (d->l_{d+1}) (d -> 1:size(block,d+1)) d->begin
# preexpr
idx_{d+1} = ( rem(l_{d+1} + off[d+1] + p.Ñ[d+1], p.Ñ[d+1]) + 1)
idx_{d+1} = ( mod(l_{d+1} + off[d+1] + p.Ñ[d+1], p.Ñ[d+1]) + 1)
end begin
# bodyexpr
@inbounds @simd for l_1 = 1:LA
Expand Down

0 comments on commit 4c9dbce

Please sign in to comment.