adapt to clang
authorLaurent Mazet <mazet@softndesign.org>
Fri, 17 Oct 2025 21:06:09 +0000 (23:06 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Fri, 17 Oct 2025 21:06:09 +0000 (23:06 +0200)
load.c

diff --git a/load.c b/load.c
index 5ec043a74d100fcb44c6a787886aa5df8b652d48..bc370fb678c144b4388b656538f3172e5711b5a7 100644 (file)
--- a/load.c
+++ b/load.c
@@ -185,13 +185,15 @@ double estimate_tics_clock (void)
 
 double estimate_cpu_clock (void)
 {
-#ifndef __arm__
-    return estimate_tics_clock ();
-#else
+#if defined(__arm__) || defined(__aarch64__)
     struct timeval tv1;
     gettimeofday (&tv1, NULL);
 
-    int instructions = 0;
+#ifdef __aarch64__ /* 64 bits */
+    int64_t instructions = 0;
+#else /* 32 bits */
+    int32_t instructions = 0;
+#endif
     while (instructions < 10000000) {
 #define INST0 "add %[i], %[i], #1\n\t"
 #define INST1 INST0 INST0 INST0 INST0  INST0 INST0 INST0 INST0 \
@@ -223,6 +225,8 @@ double estimate_cpu_clock (void)
         ((double)tv1.tv_sec + tv1.tv_usec * 1e-6);
 
     return instructions / runtime;
+#else
+    return estimate_tics_clock ();
 #endif /* __arm__ */
 }