From 80b065f757240af7920862b3e09f32a6dc06d392 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 4 Oct 2024 12:01:41 +0200 Subject: Table-based transformations (will revert immediately) This commit changes transformations to being based on a lookup table intead of a big switch. This is something I had planned for a long time and the code is nicer with this change. But unfortunately the performance is noticeably worse, so I'll revert all these changes in the next commit. I wanted to push this anyway so we can keep track of this. --- src/arch/common.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/arch/common.h') diff --git a/src/arch/common.h b/src/arch/common.h index 346403b..1469b30 100644 --- a/src/arch/common.h +++ b/src/arch/common.h @@ -1,4 +1,11 @@ +#define ZERO_CUBE cubefrompieces( \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +#define SOLVED_CUBE cubefrompieces( \ + 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) STATIC void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]); +STATIC_INLINE cube_t cubefrompieces(uint8_t, uint8_t, uint8_t, uint8_t, + uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, + uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); STATIC_INLINE bool equal(cube_t, cube_t); STATIC_INLINE cube_t invertco(cube_t); STATIC_INLINE cube_t compose_epcpeo(cube_t, cube_t); -- cgit v1.3