diff options
| -rw-r--r-- | include/action_list.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/action_list.c b/include/action_list.c index 66435dc..9e987bc 100644 --- a/include/action_list.c +++ b/include/action_list.c @@ -183,7 +183,7 @@ void action_take(action_list_t *action) { // Use the Kernighan method to count the set bits for (steps = 1; gaps_prime; steps++) gaps_prime &= gaps_prime - 1; // then from the destination to the source - for (uint8_t d = 0; d + 1 <= num; d++) { + for (uint8_t d = 0; d < num; d++) { // transfer the top colour colours[loc+steps*delta] <<= 1; colours[loc+steps*delta] |= colours[loc] & 1; @@ -256,7 +256,7 @@ void action_undo(action_list_t *action) { uint8_t steps = 1, mask = 1; if (num > 1) { - for (uint8_t d = 0; d + 1 <= num; d++) { + for (uint8_t d = 0; d < num; d++) { colours[loc] <<= 1; colours[loc] |= colours[loc+steps*delta] & 1; colours[loc+steps*delta] >>= 1; @@ -303,7 +303,7 @@ void action_to_ptn(action_list_t* action, char* out_ptn) { uint8_t mask = 1, steps = 0; // Translate to a drop sequence drops[0] = 1; mask = 1; - for (uint8_t d = 0; d + 1 < num; d++) { + for (uint8_t d = 1; d < num; d++) { if (gaps & mask) { steps++; drops[steps] = 1; // (*) no bounds check |
