1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-01-10 05:19:04 +00:00

Z period in product geometries

This commit is contained in:
Zeno Rogue
2019-11-13 20:48:38 +01:00
parent b0e481cc0a
commit 74a139ca3e
4 changed files with 49 additions and 9 deletions

View File

@@ -43,6 +43,13 @@ EX int gmod(int i, int j) {
EX int zgmod(int a, int b) { return b ? gmod(a, b) : a; }
EX int szgmod(int a, int b) {
if(!b) return a;
a = gmod(a, b);
if(2*a >= b) return a - b;
return a;
}
EX int gdiv(int i, int j) {
return (i - gmod(i, j)) / j;
}