Closed zlatanvasovic closed 4 years ago
The magic is that there is nowhere else ensures that the indices in position
are valid. The original function ensures that values in the range [-b, +inf] get mapped to [0, b).
Maybe not the best solution to do that, but I understood. Closing.
If the function doesn't have some hidden logic behind it, then it can be simplified based on the fact that (a + b) % b = a % b + b % b = a % b