From 586d5b8d7b418b3cd25b350dcc0976679ea98142 Mon Sep 17 00:00:00 2001 From: Dan McArdle Date: Tue, 21 Nov 2023 20:05:04 -0500 Subject: [PATCH] Rewrite coord_would_tick_oob() to save 49 bytes Compare the size of _CODE in 'game.map'. --- game.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/game.c b/game.c index 9cd6a8a..56cbfaa 100644 --- a/game.c +++ b/game.c @@ -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 {