From 4dbf46697c1c245a4caf49ac5a826abe4d1c9c8b Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Thu, 7 Dec 2023 00:44:19 +0400 Subject: [PATCH] Made parse_number inlined and made an arg const char *. Not sure if inlining will work, but I'm lazy to check. :P --- day2/p1.c | 4 ++-- day2/p2.c | 4 ++-- day3/p2.c | 4 ++-- day4/p1.c | 4 ++-- day4/p2.c | 4 ++-- day5/p1.c | 4 ++-- day5/p2.c | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/day2/p1.c b/day2/p1.c index 522b0e3..58ad326 100644 --- a/day2/p1.c +++ b/day2/p1.c @@ -5,7 +5,7 @@ #include -uint64_t parse_number(char *end); +inline uint64_t parse_number(const char *end); #define SETS_STR_MAX_LEN 200 @@ -66,7 +66,7 @@ int main(int argc, char **argv) { return 0; } -uint64_t parse_number(char *end) { +inline uint64_t parse_number(const char *end) { uint64_t num = 0; for (size_t n = 1;; n *= 10) { diff --git a/day2/p2.c b/day2/p2.c index b850dc0..e9747a7 100644 --- a/day2/p2.c +++ b/day2/p2.c @@ -5,7 +5,7 @@ #include -uint64_t parse_number(char *end); +inline uint64_t parse_number(const char *end); #define SETS_STR_MAX_LEN 200 @@ -72,7 +72,7 @@ int main(int argc, char **argv) { return 0; } -uint64_t parse_number(char *end) { +inline uint64_t parse_number(const char *end) { uint64_t num = 0; for (size_t n = 1;; n *= 10) { diff --git a/day3/p2.c b/day3/p2.c index bead4db..1e5002c 100644 --- a/day3/p2.c +++ b/day3/p2.c @@ -7,7 +7,7 @@ #define ISDIGIT(c) (c >= 0x30 && c <= 0x39) -uint64_t parse_number(char *line, ssize_t j); +inline uint64_t parse_number(const char *line, ssize_t j); int main(int argc, char **argv) { @@ -101,7 +101,7 @@ int main(int argc, char **argv) { return 0; } -uint64_t parse_number(char *line, ssize_t j) { +inline uint64_t parse_number(const char *line, ssize_t j) { uint64_t n = 0; uint64_t multiplier = 1; diff --git a/day4/p1.c b/day4/p1.c index ba08bd9..378d1d7 100644 --- a/day4/p1.c +++ b/day4/p1.c @@ -5,7 +5,7 @@ #include -uint64_t parse_number(char *end); +inline uint64_t parse_number(const char *end); int main(int argc, char **argv) { @@ -66,7 +66,7 @@ int main(int argc, char **argv) { return 0; } -uint64_t parse_number(char *end) { +inline uint64_t parse_number(const char *end) { uint64_t num = 0; for (size_t n = 1;; n *= 10) { diff --git a/day4/p2.c b/day4/p2.c index 62764bb..935fa48 100644 --- a/day4/p2.c +++ b/day4/p2.c @@ -8,7 +8,7 @@ #define STACK_SZ UINT8_MAX+1 typedef uint8_t stackpointer_t; -uint64_t parse_number(char *end); +inline uint64_t parse_number(const char *end); int main(int argc, char **argv) { @@ -76,7 +76,7 @@ int main(int argc, char **argv) { return 0; } -uint64_t parse_number(char *end) { +inline uint64_t parse_number(const char *end) { uint64_t num = 0; for (size_t n = 1;; n *= 10) { diff --git a/day5/p1.c b/day5/p1.c index b2f454b..a1112b6 100644 --- a/day5/p1.c +++ b/day5/p1.c @@ -5,7 +5,7 @@ #include -int64_t parse_number(char *end); +inline int64_t parse_number(const char *end); int main(int argc, char **argv) { @@ -69,7 +69,7 @@ int main(int argc, char **argv) { return 0; } -int64_t parse_number(char *end) { +inline int64_t parse_number(const char *end) { int64_t num = 0; for (size_t m = 1;; m *= 10) { diff --git a/day5/p2.c b/day5/p2.c index 754d1c0..5c3bfb3 100644 --- a/day5/p2.c +++ b/day5/p2.c @@ -5,7 +5,7 @@ #include -uint64_t parse_number(char *end); +inline uint64_t parse_number(const char *end); #define MAPS_LEN 7 @@ -100,7 +100,7 @@ int main(int argc, char **argv) { return 0; } -uint64_t parse_number(char *end) { +inline uint64_t parse_number(const char *end) { uint64_t num = 0; for (size_t m = 1;; m *= 10) {