Euclidean modulus. Always returns `0 <= mod < b`. `b` must be positive. See https://en.wikipedia.org/wiki/Euclidean_division */
| 45 | See https://en.wikipedia.org/wiki/Euclidean_division |
| 46 | */ |
| 47 | inline int eucMod(int a, int b) { |
| 48 | int mod = a % b; |
| 49 | if (mod < 0) { |
| 50 | mod += b; |
| 51 | } |
| 52 | return mod; |
| 53 | } |
| 54 | |
| 55 | /** Euclidean division. |
| 56 | `b` must be positive. |
no test coverage detected