diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-29 12:12:43 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-29 12:12:43 +0200 |
| commit | ea0387796a349c91032fbcb10f50c6ad8607b0f6 (patch) | |
| tree | aed484690d24c0c28c7695d4b5389f2e3c341b96 /src/core/cube.h | |
| parent | 52c21640508c3fc668107778ae027ff4428ebd89 (diff) | |
| download | nissy-core-ea0387796a349c91032fbcb10f50c6ad8607b0f6.tar.gz nissy-core-ea0387796a349c91032fbcb10f50c6ad8607b0f6.zip | |
All coordinates unsigned
Diffstat (limited to '')
| -rw-r--r-- | src/core/cube.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/core/cube.h b/src/core/cube.h index cdd3946..3ba282e 100644 --- a/src/core/cube.h +++ b/src/core/cube.h | |||
| @@ -5,7 +5,7 @@ STATIC bool issolved(oriented_cube_t); | |||
| 5 | STATIC bool iserror(oriented_cube_t); | 5 | STATIC bool iserror(oriented_cube_t); |
| 6 | STATIC void getcube_fix(long long *, long long *, | 6 | STATIC void getcube_fix(long long *, long long *, |
| 7 | long long *, long long *, long long *); | 7 | long long *, long long *, long long *); |
| 8 | STATIC cube_t getcube(int64_t, int64_t, int64_t, int64_t); | 8 | STATIC cube_t getcube(uint64_t, uint64_t, uint64_t, uint64_t); |
| 9 | 9 | ||
| 10 | STATIC oriented_cube_t readcube(const char *); | 10 | STATIC oriented_cube_t readcube(const char *); |
| 11 | STATIC int64_t writecube(oriented_cube_t, size_t n, char [n]); | 11 | STATIC int64_t writecube(oriented_cube_t, size_t n, char [n]); |
| @@ -150,26 +150,26 @@ getcube_fix( | |||
| 150 | { | 150 | { |
| 151 | uint8_t e[12], c[8], coarr[8]; | 151 | uint8_t e[12], c[8], coarr[8]; |
| 152 | 152 | ||
| 153 | *ep = (*ep % FACT_12 + FACT_12) % FACT_12; | 153 | *ep = POSITIVE_MOD(*ep, (long long)FACT_12); |
| 154 | *eo = (*eo % POW_2_11 + POW_2_11) % POW_2_11; | 154 | *eo = POSITIVE_MOD(*eo, (long long)POW_2_11); |
| 155 | *cp = (*cp % FACT_8 + FACT_8) % FACT_8; | 155 | *cp = POSITIVE_MOD(*cp, (long long)FACT_8); |
| 156 | *co = (*cp % POW_3_7 + POW_3_7) % POW_3_7; | 156 | *co = POSITIVE_MOD(*co, (long long)POW_3_7); |
| 157 | *orien = (*orien % 24 + 24) % 24; | 157 | *orien = POSITIVE_MOD(*orien, 24LL); |
| 158 | 158 | ||
| 159 | indextoperm(*ep, 12, e); | 159 | indextoperm((uint64_t)*ep, 12, e); |
| 160 | indextoperm(*cp, 8, c); | 160 | indextoperm((uint64_t)*cp, 8, c); |
| 161 | if (permsign(12, e) != permsign(8, c)) { | 161 | if (permsign(12, e) != permsign(8, c)) { |
| 162 | SWAP(c[0], c[1]); | 162 | SWAP(c[0], c[1]); |
| 163 | *cp = permtoindex(8, c); | 163 | *cp = (long long)permtoindex(8, c); |
| 164 | 164 | ||
| 165 | sumzerotodigits(*co, 8, 3, coarr); | 165 | sumzerotodigits((uint64_t)*co, 8, 3, coarr); |
| 166 | SWAP(coarr[0], coarr[1]); | 166 | SWAP(coarr[0], coarr[1]); |
| 167 | *co = digitstosumzero(8, coarr, 3); | 167 | *co = (uint64_t)digitstosumzero(8, coarr, 3); |
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | STATIC cube_t | 171 | STATIC cube_t |
| 172 | getcube(int64_t ep, int64_t eo, int64_t cp, int64_t co) | 172 | getcube(uint64_t ep, uint64_t eo, uint64_t cp, uint64_t co) |
| 173 | { | 173 | { |
| 174 | uint8_t i, earr[12], carr[8], eoarr[12], coarr[8]; | 174 | uint8_t i, earr[12], carr[8], eoarr[12], coarr[8]; |
| 175 | 175 | ||
