我相信你可以使用__nop内在函数.这应编译为您正在构建的处理器的相应机器指令.
http://msdn.microsoft.com/en-us/library/aa983381(VS.80).aspx
更新:
这是我刚刚用VS2008创建的一个例子.它编译Win32和x64配置:
#include "stdafx.h"
#include <intrin.h>
int _tmain(int argc, _TCHAR* argv[])
{
// The intrinsic function below will compile to a NOP machine instruction.
// This is the same as _asm nop in the 32-bit compiler.
__nop();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果你想知道,我反汇编了上面的例子,x64输出是:
wmain proc near
db 66h
nop
nop
xor eax, eax
retn
wmain endp
Run Code Online (Sandbox Code Playgroud)
Win32输出是:
_main proc near
nop
xor eax, eax
retn
_main endp
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3133 次 |
| 最近记录: |