From fd5ddb3db9f50411ca579d84f225f265ca35b56a Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 5 Sep 2024 08:53:38 +0200 Subject: Rename constants from _underscore to CAPS --- src/core/moves.h | 122 +++++++++++++++++++++++++++---------------------------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'src/core/moves.h') diff --git a/src/core/moves.h b/src/core/moves.h index 71ef470..45cd804 100644 --- a/src/core/moves.h +++ b/src/core/moves.h @@ -1,22 +1,22 @@ -#define _move(M, c) compose(c, _move_cube_ ## M) -#define _premove(M, c) compose(_move_cube_ ## M, c) +#define _move(M, c) compose(c, MOVE_CUBE_ ## M) +#define _premove(M, c) compose(MOVE_CUBE_ ## M, c) -_static_inline bool allowednextmove(uint8_t *, uint8_t); +STATIC_INLINE bool allowednextmove(uint8_t *, uint8_t); -_static_inline uint8_t inverse_trans(uint8_t); -_static_inline uint8_t movebase(uint8_t); -_static_inline uint8_t moveaxis(uint8_t); -_static_inline uint32_t disable_moves(uint32_t, uint8_t); +STATIC_INLINE uint8_t inverse_trans(uint8_t); +STATIC_INLINE uint8_t movebase(uint8_t); +STATIC_INLINE uint8_t moveaxis(uint8_t); +STATIC_INLINE uint32_t disable_moves(uint32_t, uint8_t); -_static cube_t move(cube_t, uint8_t); -_static cube_t premove(cube_t, uint8_t); -_static uint8_t inverse_move(uint8_t); -_static void invertmoves(uint8_t *, uint8_t, uint8_t *); +STATIC cube_t move(cube_t, uint8_t); +STATIC cube_t premove(cube_t, uint8_t); +STATIC uint8_t inverse_move(uint8_t); +STATIC void invertmoves(uint8_t *, uint8_t, uint8_t *); -_static cube_t applymoves(cube_t, const char *); -_static cube_t frommoves(const char *); +STATIC cube_t applymoves(cube_t, const char *); +STATIC cube_t frommoves(const char *); -_static bool +STATIC bool allowednextmove(uint8_t *moves, uint8_t n) { uint8_t base[3], axis[3]; @@ -41,69 +41,69 @@ allowednextmove(uint8_t *moves, uint8_t n) return axis[1] != axis[2] || base[0] != base[2]; } -_static_inline uint32_t +STATIC_INLINE uint32_t disable_moves(uint32_t current_result, uint8_t base_index) { return current_result & ~(7 << base_index); } -_static_inline uint8_t +STATIC_INLINE uint8_t inverse_trans(uint8_t t) { return inverse_trans_table[t]; } -_static_inline uint8_t +STATIC_INLINE uint8_t movebase(uint8_t move) { return move / 3; } -_static_inline uint8_t +STATIC_INLINE uint8_t moveaxis(uint8_t move) { return move / 6; } -_static cube_t +STATIC cube_t move(cube_t c, uint8_t m) { switch (m) { - case _move_U: + case MOVE_U: return _move(U, c); - case _move_U2: + case MOVE_U2: return _move(U2, c); - case _move_U3: + case MOVE_U3: return _move(U3, c); - case _move_D: + case MOVE_D: return _move(D, c); - case _move_D2: + case MOVE_D2: return _move(D2, c); - case _move_D3: + case MOVE_D3: return _move(D3, c); - case _move_R: + case MOVE_R: return _move(R, c); - case _move_R2: + case MOVE_R2: return _move(R2, c); - case _move_R3: + case MOVE_R3: return _move(R3, c); - case _move_L: + case MOVE_L: return _move(L, c); - case _move_L2: + case MOVE_L2: return _move(L2, c); - case _move_L3: + case MOVE_L3: return _move(L3, c); - case _move_F: + case MOVE_F: return _move(F, c); - case _move_F2: + case MOVE_F2: return _move(F2, c); - case _move_F3: + case MOVE_F3: return _move(F3, c); - case _move_B: + case MOVE_B: return _move(B, c); - case _move_B2: + case MOVE_B2: return _move(B2, c); - case _move_B3: + case MOVE_B3: return _move(B3, c); default: LOG("move error, unknown move\n"); @@ -111,45 +111,45 @@ move(cube_t c, uint8_t m) } } -_static cube_t +STATIC cube_t premove(cube_t c, uint8_t m) { switch (m) { - case _move_U: + case MOVE_U: return _premove(U3, c); - case _move_U2: + case MOVE_U2: return _premove(U2, c); - case _move_U3: + case MOVE_U3: return _premove(U, c); - case _move_D: + case MOVE_D: return _premove(D3, c); - case _move_D2: + case MOVE_D2: return _premove(D2, c); - case _move_D3: + case MOVE_D3: return _premove(D, c); - case _move_R: + case MOVE_R: return _premove(R3, c); - case _move_R2: + case MOVE_R2: return _premove(R2, c); - case _move_R3: + case MOVE_R3: return _premove(R, c); - case _move_L: + case MOVE_L: return _premove(L3, c); - case _move_L2: + case MOVE_L2: return _premove(L2, c); - case _move_L3: + case MOVE_L3: return _premove(L, c); - case _move_F: + case MOVE_F: return _premove(F3, c); - case _move_F2: + case MOVE_F2: return _premove(F2, c); - case _move_F3: + case MOVE_F3: return _premove(F, c); - case _move_B: + case MOVE_B: return _premove(B3, c); - case _move_B2: + case MOVE_B2: return _premove(B2, c); - case _move_B3: + case MOVE_B3: return _premove(B, c); default: LOG("move error, unknown move\n"); @@ -157,13 +157,13 @@ premove(cube_t c, uint8_t m) } } -_static uint8_t +STATIC uint8_t inverse_move(uint8_t m) { return m - 2 * (m % 3) + 2; } -_static void +STATIC void invertmoves(uint8_t *moves, uint8_t nmoves, uint8_t *ret) { uint8_t i; @@ -172,7 +172,7 @@ invertmoves(uint8_t *moves, uint8_t nmoves, uint8_t *ret) ret[i] = inverse_move(moves[nmoves - i - 1]); } -_static cube_t +STATIC cube_t applymoves(cube_t cube, const char *buf) { uint8_t r, m; @@ -186,7 +186,7 @@ applymoves(cube_t cube, const char *buf) b++; if (*b == '\0') goto applymoves_finish; - if ((r = readmove(*b)) == _error) + if ((r = readmove(*b)) == UINT8_ERROR) goto applymoves_error; if ((m = readmodifier(*(b+1))) != 0) b++; @@ -201,7 +201,7 @@ applymoves_error: return zero; } -_static cube_t +STATIC cube_t frommoves(const char *buf) { return applymoves(solved, buf); -- cgit v1.3