Limits `x` between `a` and `b`. If `b < a`, switches the two values. */
| 37 | If `b < a`, switches the two values. |
| 38 | */ |
| 39 | inline int clampSafe(int x, int a, int b) { |
| 40 | return (a <= b) ? clamp(x, a, b) : clamp(x, b, a); |
| 41 | } |
| 42 | |
| 43 | /** Euclidean modulus. Always returns `0 <= mod < b`. |
| 44 | `b` must be positive. |