wrap

fnT wrap(T)(T x, T a, T b)

Returns x wrapped to the range [a, b], wrapping around when out of bounds.