aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-05-18 19:32:31 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-05-18 19:32:31 +0200
commit413cc53c97f5a665bf84098b47e8d2267002f3ce (patch)
tree1d4cbae171f93e76f8587c5b10ca6ba4598caab8
parent869d852bd7bf0531af4605773615c0bf0c911d48 (diff)
downloadnissy-core-413cc53c97f5a665bf84098b47e8d2267002f3ce.tar.gz
nissy-core-413cc53c97f5a665bf84098b47e8d2267002f3ce.zip
Added esep inverse coord
-rw-r--r--TODO.txt2
-rw-r--r--src/cube_avx2.h33
-rw-r--r--src/cube_portable.h29
3 files changed, 59 insertions, 5 deletions
diff --git a/TODO.txt b/TODO.txt
index affddec..30d0247 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,7 +1,7 @@
1In progress: go back to nissy-style BFS for eosep data computation 1In progress: go back to nissy-style BFS for eosep data computation
2 - (done) compute selfsim and cocsep representatives 2 - (done) compute selfsim and cocsep representatives
3 - (done) implement set_eo_fast for invcoord_h48 3 - (done) implement set_eo_fast for invcoord_h48
4 - for invcoord_h48 remove erep, implement inverse esep coord 4 - (done) for invcoord_h48 remove erep, implement inverse esep coord
5 - add unit tests for invcoord_h48 (compute tables, if needed) 5 - add unit tests for invcoord_h48 (compute tables, if needed)
6 - change to BFS 6 - change to BFS
7 7
diff --git a/src/cube_avx2.h b/src/cube_avx2.h
index 30b0c0f..d39da94 100644
--- a/src/cube_avx2.h
+++ b/src/cube_avx2.h
@@ -273,6 +273,35 @@ set_eo_fast(cube_fast_t *cube, int64_t eo)
273_static_inline cube_fast_t 273_static_inline cube_fast_t
274invcoord_fast_esep(int64_t esep) 274invcoord_fast_esep(int64_t esep)
275{ 275{
276 /* TODO */ 276 cube_fast_t eee, ret;
277 return cubetofast(zero); 277 int64_t i, j, k, l, s, v, w, is1, set1, set2;
278 uint8_t bit2, bit1, mem[32];
279 uint8_t slice[3] = {0};
280
281 set1 = esep % 70;
282 set2 = esep / 70;
283
284 for (i = 0, j = 0, k = 4, l = 4; i < 12; i++) {
285 v = binomial[11-i][k];
286 w = binomial[7-j][l];
287 bit2 = set2 >= v;
288 bit1 = set1 >= w;
289 is1 = (1 - bit2) * bit1;
290
291 set2 -= bit2 * v;
292 k -= bit2;
293 set1 -= is1 * w;
294 l -= is1;
295 j += (1-bit2);
296 s = 2*bit2 + (1-bit2)*bit1;
297
298 mem[i+16] = (slice[s]++) | (s << 2);
299 }
300
301 ret = cubetofast(solved);
302 eee = _mm256_loadu_si256((__m256i_u *)&mem);
303 copy_edges_fast(&ret, eee);
304
305 return ret;
278} 306}
307
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
257invcoord_fast_esep(int64_t esep) 257invcoord_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}

Generated with cgit - Back to sebastiano.tronto.net