Let's introduce a special stackpointer_t type to represent a type of a stack pointer.

Also set STACK_SZ to UINT8_MAX + 1.
This commit is contained in:
Alexander Andreev 2023-12-04 18:49:03 +04:00
parent 57941c07ec
commit 96a6593672
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -6,7 +6,8 @@
#include <stdbool.h>
#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, ':');