From 067e58ea4eb2a18835eb19987c161980119019db Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 25 Apr 2013 14:44:49 +1000 Subject: [PATCH] provide a gcc style alternative to the inline asm in timing.h --- codemp/qcommon/timing.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/codemp/qcommon/timing.h b/codemp/qcommon/timing.h index df2d8a9..09b2f1f 100644 --- a/codemp/qcommon/timing.h +++ b/codemp/qcommon/timing.h @@ -12,6 +12,7 @@ public: } void Start() { +#ifdef _MSVC_VER const int64_t *s = &start; __asm { @@ -28,12 +29,15 @@ public: pop ebx pop eax } +#else + asm("rdtsc" : "=A"(start)); +#endif } int End() { - const int64_t *e = &end; int64_t time; -#ifndef __linux__ +#ifdef _MSVC_VER + const int64_t *e = &end; __asm { push eax @@ -49,6 +53,8 @@ public: pop ebx pop eax } +#else + asm("rdtsc" : "=A"(time)); #endif time = end - start; if (time < 0)