From ecd6d2bbe3eafc21b85c9467d9fb878356997946 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <pedro.gonnet@durham.ac.uk> Date: Tue, 2 Oct 2012 11:44:28 +0000 Subject: [PATCH] fix timer inlining. Former-commit-id: 782b63fbcab3d9c09598fc9192bc767f081bb399 --- examples/cycle.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/cycle.h b/examples/cycle.h index 2652a04adf..e357a017c7 100644 --- a/examples/cycle.h +++ b/examples/cycle.h @@ -171,7 +171,14 @@ INLINE_ELAPSED(__inline__) #if (defined(__GNUC__) || defined(__ICC)) && defined(__i386__) && !defined(HAVE_TICK_COUNTER) typedef unsigned long long ticks; -static __inline__ ticks getticks(void) +#ifndef INLINE +# if __GNUC__ && !__GNUC_STDC_INLINE__ +# define INLINE extern inline +# else +# define INLINE inline +# endif +#endif +INLINE ticks getticks(void) { ticks ret; @@ -220,7 +227,14 @@ static __inline double elapsed(ticks t1, ticks t0) #if (defined(__GNUC__) || defined(__ICC) || defined(__SUNPRO_C)) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER) typedef unsigned long long ticks; -static __inline__ ticks getticks(void) +#ifndef INLINE +# if __GNUC__ && !__GNUC_STDC_INLINE__ +# define INLINE extern inline +# else +# define INLINE inline +# endif +#endif +INLINE ticks getticks(void) { unsigned a, d; asm volatile("rdtsc" : "=a" (a), "=d" (d)); -- GitLab