aboutsummaryrefslogtreecommitdiff
path: root/cube.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-05 19:59:45 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-05 19:59:45 +0100
commit0c9a5d0e5c1702d07b24eeac181f78d1689c05cc (patch)
treeb07e7ade80e4d0c5163db49ccb7b542a500f28c8 /cube.c
parent1964938ca6abef6e5c81d9dccdf42c55abacb5e9 (diff)
downloadnissy-core-0c9a5d0e5c1702d07b24eeac181f78d1689c05cc.tar.gz
nissy-core-0c9a5d0e5c1702d07b24eeac181f78d1689c05cc.zip
Added coord_eo
Diffstat (limited to 'cube.c')
-rw-r--r--cube.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/cube.c b/cube.c
index e98bc40..8ca2c72 100644
--- a/cube.c
+++ b/cube.c
@@ -2104,6 +2104,19 @@ _compose(cube_t c1, cube_t c2)
2104 return ret; 2104 return ret;
2105} 2105}
2106 2106
2107static inline int16_t
2108_coord_eo(cube_t c)
2109{
2110 cube_t eo, shifted;
2111 int mask;
2112
2113 eo = _mm256_and_si256(c, _eo_avx2);
2114 shifted = _mm256_slli_epi32(eo, 3);
2115 mask = _mm256_movemask_epi8(shifted);
2116
2117 return (int16_t)(mask >> 17);
2118}
2119
2107 2120
2108/****************************************************************************** 2121/******************************************************************************
2109Section: portable fast methods 2122Section: portable fast methods
@@ -3420,6 +3433,19 @@ _compose(cube_t c1, cube_t c2)
3420 return ret; 3433 return ret;
3421} 3434}
3422 3435
3436static inline int16_t
3437_coord_eo(cube_t c)
3438{
3439 int i, p;
3440 int16_t ret;
3441
3442 ret = 0;
3443 for (i = 1, p = 1; i < 12; i++, p *= 2)
3444 ret += p * (c.e[i] >> 4);
3445
3446 return ret;
3447}
3448
3423 3449
3424#endif 3450#endif
3425 3451
@@ -3696,3 +3722,9 @@ transform(cube_t c, trans_t t)
3696 return zerocube(); 3722 return zerocube();
3697 } 3723 }
3698} 3724}
3725
3726int16_t
3727coord_eo(cube_t c)
3728{
3729 return _coord_eo(c);
3730}

Generated with cgit - Back to sebastiano.tronto.net