diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-18 19:32:31 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-18 19:32:31 +0200 |
| commit | 413cc53c97f5a665bf84098b47e8d2267002f3ce (patch) | |
| tree | 1d4cbae171f93e76f8587c5b10ca6ba4598caab8 /src/cube_portable.h | |
| parent | 869d852bd7bf0531af4605773615c0bf0c911d48 (diff) | |
| download | nissy-core-413cc53c97f5a665bf84098b47e8d2267002f3ce.tar.gz nissy-core-413cc53c97f5a665bf84098b47e8d2267002f3ce.zip | |
Added esep inverse coord
Diffstat (limited to '')
| -rw-r--r-- | src/cube_portable.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/cube_portable.h b/src/cube_portable.h index 24c39e8..cb4d8fc 100644 --- a/src/cube_portable.h +++ b/src/cube_portable.h | |||
| @@ -256,6 +256,31 @@ set_eo_fast(cube_fast_t *cube, int64_t eo) | |||
| 256 | _static_inline cube_fast_t | 256 | _static_inline cube_fast_t |
| 257 | invcoord_fast_esep(int64_t esep) | 257 | invcoord_fast_esep(int64_t esep) |
| 258 | { | 258 | { |
| 259 | /* TODO */ | 259 | cube_fast_t ret; |
| 260 | return cubetofast(zero); | 260 | int64_t i, j, k, l, s, v, w, is1, set1, set2; |
| 261 | uint8_t bit2, bit1; | ||
| 262 | uint8_t slice[3] = {0}; | ||
| 263 | |||
| 264 | ret = cubetofast(solved); | ||
| 265 | set1 = esep % 70; | ||
| 266 | set2 = esep / 70; | ||
| 267 | |||
| 268 | for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) { | ||
| 269 | v = binomial[11-i][k]; | ||
| 270 | w = binomial[7-j][l]; | ||
| 271 | bit2 = set2 >= v; | ||
| 272 | bit1 = set1 >= w; | ||
| 273 | is1 = (1 - bit2) * bit1; | ||
| 274 | |||
| 275 | set2 -= bit2 * v; | ||
| 276 | k -= bit2; | ||
| 277 | set1 -= is1 * w; | ||
| 278 | l -= is1; | ||
| 279 | j += (1-bit2); | ||
| 280 | s = 2*bit2 + (1-bit2)*bit1; | ||
| 281 | |||
| 282 | ret.edge[i] = (slice[s]++) | (s << 2); | ||
| 283 | } | ||
| 284 | |||
| 285 | return ret; | ||
| 261 | } | 286 | } |
