diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-17 07:57:18 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-17 07:57:18 +0200 |
| commit | 5e741a00a1350477c7d8778cb466c8efa27b152d (patch) | |
| tree | 37d3ab4b00f1b735f5da3b8f0065f1f19e920678 /src/arch | |
| parent | 37dc364aaf751a14ff8c7e74e6bae59128c558df (diff) | |
| download | nissy-core-5e741a00a1350477c7d8778cb466c8efa27b152d.tar.gz nissy-core-5e741a00a1350477c7d8778cb466c8efa27b152d.zip | |
Working drslice (same results as nissy-classic)
Diffstat (limited to 'src/arch')
| -rw-r--r-- | src/arch/arch.h | 3 | ||||
| -rw-r--r-- | src/arch/coordinates_unoptimized.h | 55 |
2 files changed, 58 insertions, 0 deletions
diff --git a/src/arch/arch.h b/src/arch/arch.h index a9f6e03..2c418a6 100644 --- a/src/arch/arch.h +++ b/src/arch/arch.h | |||
| @@ -7,6 +7,7 @@ typedef __m256i cube_t; | |||
| 7 | #if !defined(TEST_H) | 7 | #if !defined(TEST_H) |
| 8 | #include "common.h" | 8 | #include "common.h" |
| 9 | #include "avx2.h" | 9 | #include "avx2.h" |
| 10 | #include "coordinates_unoptimized.h" | ||
| 10 | #endif | 11 | #endif |
| 11 | 12 | ||
| 12 | #elif defined(NEON) | 13 | #elif defined(NEON) |
| @@ -22,6 +23,7 @@ typedef struct { | |||
| 22 | #if !defined(TEST_H) | 23 | #if !defined(TEST_H) |
| 23 | #include "common.h" | 24 | #include "common.h" |
| 24 | #include "neon.h" | 25 | #include "neon.h" |
| 26 | #include "coordinates_unoptimized.h" | ||
| 25 | #endif | 27 | #endif |
| 26 | 28 | ||
| 27 | #else | 29 | #else |
| @@ -36,6 +38,7 @@ typedef struct { | |||
| 36 | #if !defined(TEST_H) | 38 | #if !defined(TEST_H) |
| 37 | #include "common.h" | 39 | #include "common.h" |
| 38 | #include "portable.h" | 40 | #include "portable.h" |
| 41 | #include "coordinates_unoptimized.h" | ||
| 39 | #endif | 42 | #endif |
| 40 | 43 | ||
| 41 | #endif | 44 | #endif |
diff --git a/src/arch/coordinates_unoptimized.h b/src/arch/coordinates_unoptimized.h new file mode 100644 index 0000000..c553b2b --- /dev/null +++ b/src/arch/coordinates_unoptimized.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | STATIC_INLINE int64_t coord_cp(cube_t); | ||
| 2 | STATIC_INLINE cube_t invcoord_cp(int64_t); | ||
| 3 | STATIC_INLINE int64_t coord_epud(cube_t); | ||
| 4 | STATIC_INLINE cube_t invcoord_epud(int64_t); | ||
| 5 | |||
| 6 | STATIC_INLINE int64_t | ||
| 7 | coord_cp(cube_t cube) | ||
| 8 | { | ||
| 9 | int i; | ||
| 10 | uint8_t c[8], e[12]; | ||
| 11 | |||
| 12 | pieces(&cube, c, e); | ||
| 13 | for (i = 0; i < 8; i++) | ||
| 14 | c[i] &= PBITS; | ||
| 15 | |||
| 16 | return permtoindex(8, c); | ||
| 17 | } | ||
| 18 | |||
| 19 | STATIC_INLINE cube_t | ||
| 20 | invcoord_cp(int64_t i) | ||
| 21 | { | ||
| 22 | uint8_t c[8]; | ||
| 23 | |||
| 24 | indextoperm(i, 8, c); | ||
| 25 | |||
| 26 | return STATIC_CUBE(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], | ||
| 27 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); | ||
| 28 | } | ||
| 29 | |||
| 30 | STATIC_INLINE int64_t | ||
| 31 | coord_epud(cube_t cube) | ||
| 32 | { | ||
| 33 | int i; | ||
| 34 | uint8_t c[8], e[12]; | ||
| 35 | |||
| 36 | pieces(&cube, c, e); | ||
| 37 | DBG_ASSERT(isperm(8, e), -1, | ||
| 38 | "Cannot compute epud coordinate: edges not separated"); | ||
| 39 | |||
| 40 | for (i = 0; i < 8; i++) | ||
| 41 | e[i] &= PBITS; | ||
| 42 | |||
| 43 | return permtoindex(8, e); | ||
| 44 | } | ||
| 45 | |||
| 46 | STATIC_INLINE cube_t | ||
| 47 | invcoord_epud(int64_t i) | ||
| 48 | { | ||
| 49 | uint8_t e[8]; | ||
| 50 | |||
| 51 | indextoperm(i, 8, e); | ||
| 52 | |||
| 53 | return STATIC_CUBE(0, 1, 2, 3, 4, 5, 6, 7, | ||
| 54 | e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], 8, 9, 10, 11); | ||
| 55 | } | ||
