diff options
Diffstat (limited to 'src/arch/portable.h')
| -rw-r--r-- | src/arch/portable.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/arch/portable.h b/src/arch/portable.h index e9a8dd0..b8c5211 100644 --- a/src/arch/portable.h +++ b/src/arch/portable.h | |||
| @@ -9,6 +9,18 @@ | |||
| 9 | #define SOLVED_CUBE STATIC_CUBE( \ | 9 | #define SOLVED_CUBE STATIC_CUBE( \ |
| 10 | 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) | 10 | 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) |
| 11 | 11 | ||
| 12 | /* TODO: optimize this (use bit tricks?) */ | ||
| 13 | STATIC_INLINE int | ||
| 14 | popcount_u32(uint32_t x) | ||
| 15 | { | ||
| 16 | int ret; | ||
| 17 | |||
| 18 | for (ret = 0; x != 0; x >>= 1) | ||
| 19 | ret += x & 1; | ||
| 20 | |||
| 21 | return ret; | ||
| 22 | } | ||
| 23 | |||
| 12 | STATIC void | 24 | STATIC void |
| 13 | pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) | 25 | pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) |
| 14 | { | 26 | { |
