From fbdc38a171294fc90a153c73d60994559c5b51f6 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Wed, 6 Dec 2023 04:19:03 +0400 Subject: [PATCH] In d5p1 also replaced int64_t with uint64_t. --- day5/p1.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/day5/p1.c b/day5/p1.c index d458ac8..e33ffc1 100644 --- a/day5/p1.c +++ b/day5/p1.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) { space_pos++; } - int64_t *data = (int64_t *) calloc(data_len, sizeof(int64_t)); + uint64_t *data = (uint64_t *) calloc(data_len, sizeof(uint64_t)); bool *data_v = (bool *) calloc(data_len, sizeof(bool)); for (size_t i = 0, seeds_pos = (size_t) colon_pos+2;; seeds_pos++) { @@ -48,8 +48,8 @@ int main(int argc, char **argv) { continue; } - int64_t dst = 0, src = 0, rng = 0; - sscanf(line, "%ld %ld %ld\n", &dst, &src, &rng); + uint64_t dst = 0, src = 0, rng = 0; + sscanf(line, "%lu %lu %lu\n", &dst, &src, &rng); for (size_t i = 0; i < data_len; ++i) { if (!data_v[i] && data[i] >= src && data[i] <= src+rng-1) { @@ -61,12 +61,12 @@ int main(int argc, char **argv) { memset(line, 0, line_buf_length); } - int64_t lowest_loc_n = INT32_MAX; + uint64_t lowest_loc_n = INT32_MAX; for (size_t i = 0; i < data_len; ++i) lowest_loc_n = (data[i] < lowest_loc_n) ? data[i] : lowest_loc_n; - printf("%ld\n", lowest_loc_n); + printf("%lu\n", lowest_loc_n); return 0; }