Skip to content
Snippets Groups Projects
Commit 056f0983 authored by Nicky's avatar Nicky
Browse files

Windows x64: Cannot use inline assembly.

(transplanted from ee32840fc591f5529a0b544243e7b4146eb8f531)
parent d75a6ecb
No related branches found
No related tags found
No related merge requests found
...@@ -91,6 +91,7 @@ class BlockTimer ...@@ -91,6 +91,7 @@ class BlockTimer
static U32 getCPUClockCount32() static U32 getCPUClockCount32()
{ {
U32 ret_val; U32 ret_val;
#if !defined(_M_AMD64)
__asm __asm
{ {
_emit 0x0f _emit 0x0f
...@@ -100,6 +101,11 @@ class BlockTimer ...@@ -100,6 +101,11 @@ class BlockTimer
or eax, edx or eax, edx
mov dword ptr [ret_val], eax mov dword ptr [ret_val], eax
} }
#else
unsigned __int64 val = __rdtsc();
val = val >> 8;
ret_val = static_cast<U32>(val);
#endif
return ret_val; return ret_val;
} }
...@@ -107,6 +113,7 @@ class BlockTimer ...@@ -107,6 +113,7 @@ class BlockTimer
static U64 getCPUClockCount64() static U64 getCPUClockCount64()
{ {
U64 ret_val; U64 ret_val;
#if !defined(_M_AMD64)
__asm __asm
{ {
_emit 0x0f _emit 0x0f
...@@ -116,6 +123,9 @@ class BlockTimer ...@@ -116,6 +123,9 @@ class BlockTimer
mov dword ptr [ret_val+4], edx mov dword ptr [ret_val+4], edx
mov dword ptr [ret_val], eax mov dword ptr [ret_val], eax
} }
#else
ret_val = static_cast<U64>( __rdtsc() );
#endif
return ret_val; return ret_val;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment