Begs the question, do you play the start/end point once or twice? 1,2,3,3,2,1,1,2… vs 1,2,3,2,1,2… Possibly a matter of choice?
The snippet doesn’t flip the sense of loop_dir. It would seem like having loop_dir as +/-1, would also make the increment easier.