From cfed35b3dad2a6cb510fd008bb0f77c1e6e5dbed Mon Sep 17 00:00:00 2001
From: Luke Wren <wren6991@gmail.com>
Date: Tue, 24 May 2022 18:22:25 +0100
Subject: [PATCH] Fix the stupid printf warning on x86-64 as well as arm64

---
 test/sim/tb_cxxrtl/tb.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/sim/tb_cxxrtl/tb.cpp b/test/sim/tb_cxxrtl/tb.cpp
index 2c12080..7a14697 100644
--- a/test/sim/tb_cxxrtl/tb.cpp
+++ b/test/sim/tb_cxxrtl/tb.cpp
@@ -12,6 +12,13 @@
 #include "dut.cpp"
 #include <backends/cxxrtl/cxxrtl_vcd.h>
 
+// There must be a better way
+#ifdef __x86_64__
+#define I64_FMT "%ld"
+#else
+#define I64_FMT "%lld"
+#endif
+
 // -----------------------------------------------------------------------------
 
 static const int MEM_SIZE = 16 * 1024 * 1024;
@@ -556,7 +563,7 @@ int main(int argc, char **argv) {
 
 		if (memio.exit_req) {
 			printf("CPU requested halt. Exit code %d\n", memio.exit_code);
-			printf("Ran for %lld cycles\n", cycle + 1);
+			printf("Ran for " I64_FMT " cycles\n", cycle + 1);
 			break;
 		}
 		if (cycle + 1 == max_cycles)