我正在尝试弄清楚如何在 C++ 中读取此汇编代码。
这是代码:
unsigned __int64 high_perf_time;
unsigned __int64 *dest = &high_perf_time;
__asm
{
_emit 0xf // these two bytes form the 'rdtsc' asm instruction,
_emit 0x31 // available on Pentium I and later.
mov esi, dest
mov [esi ], eax // lower 32 bits of tsc
mov [esi+4], edx // upper 32 bits of tsc
}
__int64 time_s = (__int64)(high_perf_time / frequency); // unsigned->sign conversion should be safe here
__int64 time_fract = (__int64)(high_perf_time % frequency); // unsigned->sign conversion should …Run Code Online (Sandbox Code Playgroud)