From 96a65936723c948fe1c585fac37fdeb407c8196f Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 4 Dec 2023 18:49:03 +0400 Subject: [PATCH] Let's introduce a special stackpointer_t type to represent a type of a stack pointer. Also set STACK_SZ to UINT8_MAX + 1. --- day4/p2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/day4/p2.c b/day4/p2.c index dffbab8..9756d00 100644 --- a/day4/p2.c +++ b/day4/p2.c @@ -6,7 +6,8 @@ #include -#define STACK_SZ 256 +#define STACK_SZ UINT8_MAX+1 +typedef uint8_t stackpointer_t; int32_t parse_number(char *end); @@ -30,7 +31,7 @@ int main(int argc, char **argv) { char *colon_pos = NULL, *pipe_pos = NULL; uint64_t stack[STACK_SZ] = {0}; - uint8_t stack_pos = 0; + stackpointer_t stack_pos = 0; while (getline(&line, &line_length, input) != -1) { colon_pos = strchr(line, ':');