Fix infinite loop bug

This commit is contained in:
ysyapa 2023-08-30 21:20:17 +00:00
parent e7fa5c3b3c
commit fd262cd8c9
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ which_index(s::system, dim::Int, coord::Int)::Int = (dim - 1) * (s.n - 1) + coor
function nearest(s::system, Δk::Int)::Int
# TODO: Optimize
while true
if Δk > (s.N ÷ 2 - 1)
if Δk >= s.N ÷ 2
Δk -= s.N
elseif Δk < -s.N ÷ 2
Δk += s.N