From c905abba660c7790870137fa515c26ee4ff302c8 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Thu, 3 Aug 2023 07:49:13 +0900 Subject: [PATCH] Fix junk_data for 32-bit platforms Previously this had a mismatch between size_t and unsigned long long. --- test/junk_data.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/junk_data.cc b/test/junk_data.cc index 3d40eed3a..58026bb4f 100644 --- a/test/junk_data.cc +++ b/test/junk_data.cc @@ -21,6 +21,7 @@ // Generate junk data at high speed. An alternative to dd if=/dev/urandom. #include +#include #include int main(int argc, const char *argv[]) @@ -28,11 +29,11 @@ int main(int argc, const char *argv[]) if (argc != 2) { return 1; } - unsigned long long count = strtoull(argv[1], nullptr, 10); + uint64_t count = strtoull(argv[1], nullptr, 10); char buf[128 * 1024]; - for (size_t i = 0; i < count; i += sizeof(buf)) { - for (size_t j = 0; j < sizeof(buf) / sizeof(i); ++j) { - *(reinterpret_cast(buf) + j) = i / sizeof(i) + j; + for (uint64_t i = 0; i < count; i += sizeof(buf)) { + for (uint64_t j = 0; j < sizeof(buf) / sizeof(i); ++j) { + *(reinterpret_cast(buf) + j) = i / sizeof(i) + j; } fwrite(buf, 1, sizeof(buf) > count - i ? count - i : sizeof(buf), stdout); }