From 28ad019d62583b7e89b4e76922aa73857d5876eb Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 28 May 2024 15:42:26 +0200 Subject: Added roadmap for refactor and some simple routines --- src/cube_avx2.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/cube_avx2.h') diff --git a/src/cube_avx2.h b/src/cube_avx2.h index 233afed..f3fe731 100644 --- a/src/cube_avx2.h +++ b/src/cube_avx2.h @@ -14,6 +14,8 @@ _static_inline cube_fast_t fastcube( uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t ); +_static uint8_t corner(cube_fast_t, int); +_static uint8_t edge(cube_fast_t, int); _static cube_fast_t cubetofast(cube_t); _static cube_t fasttocube(cube_fast_t); _static_inline bool equal_fast(cube_fast_t, cube_fast_t); @@ -68,6 +70,28 @@ fastcube( ); } +_static uint8_t +corner(cube_fast_t c, int i) +{ + uint8_t aux[32]; + + DBG_ASSERT(i >= 0 && i < 8, 255, "Corner must be between 0 and 7\n"); + _mm256_storeu_si256((__m256i_u *)aux, c); + + return aux[i]; +} + +_static uint8_t +edge(cube_fast_t c, int i) +{ + uint8_t aux[32]; + + DBG_ASSERT(i >= 0 && i < 12, 255, "Edge must be between 0 and 11\n"); + _mm256_storeu_si256((__m256i_u *)aux, c); + + return aux[i+16]; +} + _static cube_fast_t cubetofast(cube_t a) { @@ -338,4 +362,3 @@ invcoord_fast_esep(int64_t esep) return ret; } - -- cgit v1.3