diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-04 12:15:37 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-10-04 12:15:37 +0200 |
| commit | 0de1530f4cea21f2bc0a0e0f1cbf9da016c7bda5 (patch) | |
| tree | a0a64424190588e5f734c257dd312e1f89fcd1eb /src/arch/neon.h | |
| parent | 80b065f757240af7920862b3e09f32a6dc06d392 (diff) | |
| download | nissy-core-0de1530f4cea21f2bc0a0e0f1cbf9da016c7bda5.tar.gz nissy-core-0de1530f4cea21f2bc0a0e0f1cbf9da016c7bda5.zip | |
Revert table-based transformations
Long live the giant switch!
Diffstat (limited to 'src/arch/neon.h')
| -rw-r--r-- | src/arch/neon.h | 57 |
1 files changed, 19 insertions, 38 deletions
diff --git a/src/arch/neon.h b/src/arch/neon.h index 9061422..acb75c3 100644 --- a/src/arch/neon.h +++ b/src/arch/neon.h | |||
| @@ -7,6 +7,25 @@ | |||
| 7 | STATIC_INLINE uint8x16_t compose_edges_slim(uint8x16_t, uint8x16_t); | 7 | STATIC_INLINE uint8x16_t compose_edges_slim(uint8x16_t, uint8x16_t); |
| 8 | STATIC_INLINE uint8x16_t compose_corners_slim(uint8x16_t, uint8x16_t); | 8 | STATIC_INLINE uint8x16_t compose_corners_slim(uint8x16_t, uint8x16_t); |
| 9 | 9 | ||
| 10 | // static cube | ||
| 11 | #define STATIC_CUBE(c_ufr, c_ubl, c_dfl, c_dbr, c_ufl, c_ubr, c_dfr, c_dbl, \ | ||
| 12 | e_uf, e_ub, e_db, e_df, e_ur, e_ul, e_dl, e_dr, e_fr, e_fl, e_bl, e_br) \ | ||
| 13 | ((cube_t){ \ | ||
| 14 | .corner = {c_ufr, c_ubl, c_dfl, c_dbr, c_ufl, c_ubr, c_dfr, c_dbl, 0, 0, 0, 0, 0, 0, 0, 0}, \ | ||
| 15 | .edge = {e_uf, e_ub, e_db, e_df, e_ur, e_ul, e_dl, e_dr, e_fr, e_fl, e_bl, e_br, 0, 0, 0, 0}}) | ||
| 16 | |||
| 17 | // zero cube | ||
| 18 | #define ZERO_CUBE \ | ||
| 19 | (cube_t) \ | ||
| 20 | { \ | ||
| 21 | .corner = vdupq_n_u8(0), \ | ||
| 22 | .edge = vdupq_n_u8(0) \ | ||
| 23 | } | ||
| 24 | |||
| 25 | // solved cube | ||
| 26 | #define SOLVED_CUBE STATIC_CUBE( \ | ||
| 27 | 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) | ||
| 28 | |||
| 10 | STATIC void | 29 | STATIC void |
| 11 | pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) | 30 | pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) |
| 12 | { | 31 | { |
| @@ -20,44 +39,6 @@ pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) | |||
| 20 | vst1_lane_u32((uint32_t *)(e + 8), vreinterpret_u32_u8(vget_high_u8(cube->edge)), 0); | 39 | vst1_lane_u32((uint32_t *)(e + 8), vreinterpret_u32_u8(vget_high_u8(cube->edge)), 0); |
| 21 | } | 40 | } |
| 22 | 41 | ||
| 23 | STATIC_INLINE cube_t | ||
| 24 | cubefrompieces( | ||
| 25 | uint8_t c_ufr, | ||
| 26 | uint8_t c_ubl, | ||
| 27 | uint8_t c_dfl, | ||
| 28 | uint8_t c_dbr, | ||
| 29 | uint8_t c_ufl, | ||
| 30 | uint8_t c_ubr, | ||
| 31 | uint8_t c_dfr, | ||
| 32 | uint8_t c_dbl, | ||
| 33 | |||
| 34 | uint8_t e_uf, | ||
| 35 | uint8_t e_ub, | ||
| 36 | uint8_t e_db, | ||
| 37 | uint8_t e_df, | ||
| 38 | uint8_t e_ur, | ||
| 39 | uint8_t e_ul, | ||
| 40 | uint8_t e_dl, | ||
| 41 | uint8_t e_dr, | ||
| 42 | uint8_t e_fr, | ||
| 43 | uint8_t e_fl, | ||
| 44 | uint8_t e_bl, | ||
| 45 | uint8_t e_br | ||
| 46 | ) { | ||
| 47 | cube_t ret = { | ||
| 48 | .corner = { | ||
| 49 | c_ufr, c_ubl, c_dfl, c_dbr, c_ufl, c_ubr, c_dfr, c_dbl, | ||
| 50 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 51 | }, | ||
| 52 | .edge = { | ||
| 53 | e_uf, e_ub, e_db, e_df, e_ur, e_ul, e_dl, e_dr, e_fr, | ||
| 54 | e_fl, e_bl, e_br, 0, 0, 0, 0 | ||
| 55 | } | ||
| 56 | }; | ||
| 57 | |||
| 58 | return ret; | ||
| 59 | } | ||
| 60 | |||
| 61 | STATIC_INLINE bool | 42 | STATIC_INLINE bool |
| 62 | equal(cube_t c1, cube_t c2) | 43 | equal(cube_t c1, cube_t c2) |
| 63 | { | 44 | { |
