aboutsummaryrefslogtreecommitdiff
path: root/src/coord.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/coord.c')
-rw-r--r--src/coord.c41
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)
437static uint64_t 455static uint64_t
438index_htr_drud(Cube cube) 456index_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
444static uint64_t 479static uint64_t

Generated with cgit - Back to sebastiano.tronto.net