Skip to content

Commit

Permalink
Rewrite coord_would_tick_oob() to save 49 bytes
Browse files Browse the repository at this point in the history
Compare the size of _CODE in 'game.map'.
  • Loading branch information
dmcardle committed Nov 22, 2023
1 parent 8f57c9a commit 586d5b8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,8 @@ coord_t coord_tick(coord_t coord) {
}

bool coord_would_tick_oob(coord_t coord, uint8_t lo, uint8_t hi) {
int16_t pos = coord.pos;
if (coord.negative) {
pos -= coord.speed;
} else {
pos += coord.speed;
}
return !((int16_t)lo <= pos && pos <= (int16_t)hi);
coord = coord_tick(coord);
return lo > coord.pos || coord.pos > hi;
}

typedef struct ball {
Expand Down

0 comments on commit 586d5b8

Please sign in to comment.