mirror of
https://github.com/ioquake/jedi-academy.git
synced 2025-02-16 17:20:59 +00:00
provide a gcc style alternative to the inline asm in timing.h
This commit is contained in:
parent
d140164808
commit
067e58ea4e
1 changed files with 8 additions and 2 deletions
|
@ -12,6 +12,7 @@ public:
|
||||||
}
|
}
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
#ifdef _MSVC_VER
|
||||||
const int64_t *s = &start;
|
const int64_t *s = &start;
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
|
@ -28,12 +29,15 @@ public:
|
||||||
pop ebx
|
pop ebx
|
||||||
pop eax
|
pop eax
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
asm("rdtsc" : "=A"(start));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
int End()
|
int End()
|
||||||
{
|
{
|
||||||
const int64_t *e = &end;
|
|
||||||
int64_t time;
|
int64_t time;
|
||||||
#ifndef __linux__
|
#ifdef _MSVC_VER
|
||||||
|
const int64_t *e = &end;
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push eax
|
push eax
|
||||||
|
@ -49,6 +53,8 @@ public:
|
||||||
pop ebx
|
pop ebx
|
||||||
pop eax
|
pop eax
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
asm("rdtsc" : "=A"(time));
|
||||||
#endif
|
#endif
|
||||||
time = end - start;
|
time = end - start;
|
||||||
if (time < 0)
|
if (time < 0)
|
||||||
|
|
Loading…
Reference in a new issue