Skip to content

Commit

Permalink
Do not do the swap if the index is the same -- fixing ESCOMP#397
Browse files Browse the repository at this point in the history
  • Loading branch information
ekluzek committed Jun 4, 2023
1 parent bdf4d46 commit 4addd32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions route/build/src/nr_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ SUBROUTINE indexx(arr,index)
jstack=jstack-2
else
k=(l+r)/2
call swap(index(k),index(l+1))
if ( k /= l+1 ) call swap(index(k),index(l+1))
call icomp_xchg(index(l),index(r))
call icomp_xchg(index(l+1),index(r))
call icomp_xchg(index(l),index(l+1))
Expand All @@ -126,7 +126,7 @@ SUBROUTINE indexx(arr,index)
if (arr(index(j)) <= a) exit
end do
if (j < i) exit
call swap(index(i),index(j))
if ( i /= j ) call swap(index(i),index(j))
end do
index(l+1)=index(j)
index(j)=indext
Expand Down

0 comments on commit 4addd32

Please sign in to comment.