commit f9570e5089eeabe32be84ab0507c1d9df99650af
parent 7c994d0ee99d8b69bf958f1559db3a294f459e3e
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Wed, 16 Oct 2024 11:46:33 +0200
Removed redundant coordinate computation
Diffstat:
5 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -8,6 +8,7 @@ utils/.DS_Store
perf.data
perf.data.old
run
+debugrun
shell/lasttest.out
shell/lasttest.err
tables/*
diff --git a/debugrun b/debugrun
Binary files differ.
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
@@ -24,8 +24,6 @@ STATIC_INLINE uint8_t get_h48_pval_atomic(
_Atomic const uint8_t *, int64_t, uint8_t);
STATIC_INLINE void set_h48_pval_atomic(
_Atomic uint8_t *, int64_t, uint8_t, uint8_t);
-STATIC_INLINE uint8_t get_h48_bound(
- cube_t, uint32_t, uint8_t, uint8_t, const uint8_t *);
size_t gendata_h48_derive(uint8_t, const void *, void *);
@@ -686,20 +684,6 @@ set_h48_pval_atomic(_Atomic uint8_t *table, int64_t i, uint8_t k, uint8_t val)
| (val << H48_SHIFT(i, k));
}
-STATIC_INLINE uint8_t
-get_h48_bound(
- cube_t cube,
- uint32_t cdata,
- uint8_t h,
- uint8_t k,
- const uint8_t *table
-) {
- int64_t coord;
-
- coord = coord_h48_edges(cube, COCLASS(cdata), TTREP(cdata), h);
- return get_h48_pval(table, coord, k);
-}
-
size_t
gendata_h48_derive(uint8_t h, const void *fulltable, void *buf)
{
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h
@@ -101,6 +101,7 @@ solve_h48_stop(dfsarg_solveh48_t *arg)
{
uint32_t data, data_inv;
int8_t cbound, cbound_inv, h48bound, h48bound_inv;
+ int64_t coord, coord_inv;
arg->nissbranch = MM_NORMAL;
cbound = get_h48_cdata(arg->cube, arg->cocsepdata, &data);
@@ -111,15 +112,16 @@ solve_h48_stop(dfsarg_solveh48_t *arg)
if (cbound_inv + arg->nmoves + arg->npremoves > arg->depth)
return true;
- h48bound = get_h48_bound(arg->cube, data, arg->h, arg->k, arg->h48data);
+ coord = coord_h48_edges(arg->cube, COCLASS(data), TTREP(data), arg->h);
+ h48bound = get_h48_pval(arg->h48data, coord, arg->k);
/* If the h48 bound is > 0, we add the base value. */
/* Otherwise, we use the fallback h0k4 value instead. */
if (arg->k == 2) {
if (h48bound == 0) {
- h48bound = get_h48_bound(
- arg->cube, data, 0, 4, arg->h48data_fallback);
+ h48bound = get_h48_pval(
+ arg->h48data_fallback, coord >> arg->h, 4);
} else {
h48bound += arg->base;
}
@@ -129,11 +131,13 @@ solve_h48_stop(dfsarg_solveh48_t *arg)
if (h48bound + arg->nmoves + arg->npremoves == arg->depth)
arg->nissbranch = MM_INVERSEBRANCH;
- h48bound_inv = get_h48_bound(arg->inverse, data_inv, arg->h, arg->k, arg->h48data);
+ coord_inv = coord_h48_edges(
+ arg->inverse, COCLASS(data_inv), TTREP(data_inv), arg->h);
+ h48bound_inv = get_h48_pval(arg->h48data, coord_inv, arg->k);
if (arg->k == 2) {
if (h48bound_inv == 0) {
- h48bound_inv = get_h48_bound(
- arg->inverse, data_inv, 0, 4, arg->h48data_fallback);
+ h48bound_inv = get_h48_pval(
+ arg->h48data_fallback, coord_inv >> arg->h, 4);
} else {
h48bound_inv += arg->base;
}
diff --git a/src/solvers/h48/stats.h b/src/solvers/h48/stats.h
@@ -36,7 +36,7 @@ solve_h48stats_dfs(dfsarg_solveh48stats_t *arg)
/* Check h48 lower bound for h=0 (esep, but no eo) */
coord = coord_h48_edges(arg->cube, COCLASS(d), TTREP(d), 0);
- bound = get_h48_bound(arg->cube, d, 0, 4, arg->h48data);
+ bound = get_h48_pval(arg->h48data, coord, 4);
if (bound + arg->nmoves > arg->depth)
return 0;