diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-13 17:13:24 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-13 17:13:24 +0100 |
| commit | 1a90075f672a442cafa35c1cccbb6cf026c3980e (patch) | |
| tree | 6b1b89477b984df3873806450f955770d0d850d2 /src/coord.c | |
| parent | e864e23e3ec315d5969281c51f24521cde30792a (diff) | |
| download | nissy-1a90075f672a442cafa35c1cccbb6cf026c3980e.tar.gz nissy-1a90075f672a442cafa35c1cccbb6cf026c3980e.zip | |
Fixed a problem with htr-drud coordinates. The corresponding pruning table also changed, hopefully the new one is correct.
Diffstat (limited to '')
| -rw-r--r-- | src/coord.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/coord.c b/src/coord.c index 059a7a2..3d5e785 100644 --- a/src/coord.c +++ b/src/coord.c | |||
| @@ -327,9 +327,27 @@ antindex_htr_drud(uint64_t ind) | |||
| 327 | /* The returned cube is NOT consistent: corl and cofb can be wrong */ | 327 | /* The returned cube is NOT consistent: corl and cofb can be wrong */ |
| 328 | /* (see cphtr) and eposm can be wrong too (not epose because dr). */ | 328 | /* (see cphtr) and eposm can be wrong too (not epose because dr). */ |
| 329 | Cube ret = {0}; | 329 | Cube ret = {0}; |
| 330 | static bool initialized = false; | ||
| 331 | static int aux[BINOM8ON4], ep[12], ep2[12]; | ||
| 332 | static int eps_solved[4] = {UL, UR, DL, DR}; | ||
| 333 | unsigned int i, j, k; | ||
| 334 | |||
| 335 | if (!initialized) { | ||
| 336 | for (i = 0; i < BINOM8ON4; i++) { | ||
| 337 | for (j = 0; j < 12; j++) | ||
| 338 | ep[j] = ep2[j] = 0; | ||
| 339 | index_to_subset(i, 8, 4, ep); | ||
| 340 | for (j = 0, k = 0; j < 8; j++) | ||
| 341 | ep2[j] = ep[j/2+4*(j%2)] ? eps_solved[k++] : 0; | ||
| 342 | aux[i] = array_ep_to_epos(ep2, eps_solved); | ||
| 343 | } | ||
| 344 | |||
| 345 | initialized = true; | ||
| 346 | } | ||
| 330 | 347 | ||
| 331 | ret = antindex_cphtr(ind / BINOM8ON4); | 348 | ret = antindex_cphtr(ind / BINOM8ON4); |
| 332 | ret.eposs = (ind % BINOM8ON4) * FACTORIAL4; | 349 | ret.epose = 0; |
| 350 | ret.eposs = aux[ind % BINOM8ON4]; | ||
| 333 | 351 | ||
| 334 | return ret; | 352 | return ret; |
| 335 | } | 353 | } |
| @@ -437,8 +455,25 @@ index_drud_eofb(Cube cube) | |||
| 437 | static uint64_t | 455 | static uint64_t |
| 438 | index_htr_drud(Cube cube) | 456 | index_htr_drud(Cube cube) |
| 439 | { | 457 | { |
| 440 | return index_cphtr(cube) * BINOM8ON4 + | 458 | static bool initialized = false; |
| 441 | (cube.eposs / FACTORIAL4) % BINOM8ON4; | 459 | static int aux[BINOM12ON4], ep[12], ep2[12]; |
| 460 | static int eps_solved[4] = {UL, UR, DL, DR}; | ||
| 461 | unsigned int i, j; | ||
| 462 | |||
| 463 | if (!initialized) { | ||
| 464 | for (i = 0; i < BINOM12ON4; i++) { | ||
| 465 | for (j = 0; j < 12; j++) | ||
| 466 | ep[j] = ep2[j] = 0; | ||
| 467 | epos_to_partial_ep(i*24, ep, eps_solved); | ||
| 468 | for (j = 0; j < 8; j++) | ||
| 469 | ep2[j/2 + 4*(j%2)] = ep[j] ? 1 : 0; | ||
| 470 | aux[i] = subset_to_index(ep2, 8, 4); | ||
| 471 | } | ||
| 472 | |||
| 473 | initialized = true; | ||
| 474 | } | ||
| 475 | |||
| 476 | return index_cphtr(cube) * BINOM8ON4 + aux[cube.eposs/24]; | ||
| 442 | } | 477 | } |
| 443 | 478 | ||
| 444 | static uint64_t | 479 | static uint64_t |
