From 0962191f3a95bd3e700f6029115924107885a30d Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Fri, 17 Oct 2025 23:06:09 +0200 Subject: [PATCH] adapt to clang --- load.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/load.c b/load.c index 5ec043a..bc370fb 100644 --- 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__ */ } -- 2.30.2