From 5dbe51a52e16e720883f9b44e1a8608a4311cd36 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 26 Mar 2024 03:03:33 +0200 Subject: [PATCH] Userspace: Update printf formats to compile on 32 bit --- userspace/aoc2023/day19/main.cpp | 2 +- userspace/image/Netbpm.cpp | 2 +- userspace/mmap-shared-test/main.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/userspace/aoc2023/day19/main.cpp b/userspace/aoc2023/day19/main.cpp index 7a18fe0f..d0c39d16 100644 --- a/userspace/aoc2023/day19/main.cpp +++ b/userspace/aoc2023/day19/main.cpp @@ -260,7 +260,7 @@ i64 puzzle2(FILE* fp) clock_gettime(CLOCK_MONOTONIC, &time_stop); u64 duration_us = (time_stop.tv_sec * 1'000'000 + time_stop.tv_nsec / 1'000) - (time_start.tv_sec * 1'000'000 + time_start.tv_nsec / 1'000); - printf("took %lu.%03lu ms, estimate %lu s\n", duration_us / 1000, duration_us % 1000, (values_sorted[0].size() - xi - 2) * duration_us / 1'000'000); + printf("step took %" PRIu64 ".%03" PRIu64 " ms, estimate %" PRIu64 " s\n", duration_us / 1000, duration_us % 1000, (values_sorted[0].size() - xi - 2) * duration_us / 1'000'000); } return result; diff --git a/userspace/image/Netbpm.cpp b/userspace/image/Netbpm.cpp index 485f2958..4d89ed7e 100644 --- a/userspace/image/Netbpm.cpp +++ b/userspace/image/Netbpm.cpp @@ -87,7 +87,7 @@ BAN::ErrorOr> load_netbpm(const void* mmap_addr, size_t size return BAN::Error::from_errno(EINVAL); } - printf("Netbpm image %" PRIuPTR "x%" PRIuPTR "\n", *width, *height); + printf("Netbpm image %" PRIu64 "x%" PRIu64 "\n", *width, *height); BAN::Vector bitmap; TRY(bitmap.resize(*width * *height)); diff --git a/userspace/mmap-shared-test/main.cpp b/userspace/mmap-shared-test/main.cpp index 68de5710..b27b3ccd 100644 --- a/userspace/mmap-shared-test/main.cpp +++ b/userspace/mmap-shared-test/main.cpp @@ -152,7 +152,7 @@ int test2_job2() return 1; } - *(size_t*)addr = 0x123456789; + *(size_t*)addr = 0x12345678; if (msync(addr, sizeof(size_t), MS_SYNC) == -1) {