小编mao*_*r03的帖子

此汇编代码的 C++ 等效项是什么

我正在尝试弄清楚如何在 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)

c++ assembly rdtsc

2
推荐指数
1
解决办法
213
查看次数

标签 统计

assembly ×1

c++ ×1

rdtsc ×1