零出64位寄存器的高32位 [英] zero out top 32 bits of 64-bit register
问题描述
使用AMD64组装,最新最好的方式来零出一个64位的寄存器,例如顶部的32位零出未涵盖的EAX RAX的位?看来,我不能和针对64位常量整个寄存器。
Using amd64 assembly, whats the best way to zero out the top 32 bits of a 64-bit register, e.g. zero out the bits of rax that are not covered by eax? It appears that I cannot and the whole register against a 64-bit constant.
推荐答案
MOVL%eax中,%EAX
或 MOV EAX,EAX
,这取决于所使用的汇编。
movl %eax, %eax
or mov eax, eax
, depending on the assembler in use.
看到:英特尔®64和IA-32架构 - 软件开发人员手册,<一个href=\"http://www.intel.com.au/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-1-manual.pdf\">Volume 1 ,3.4.1.1:在64位模式通用寄存器
see: Intel® 64 and IA-32 Architectures - Software Developer’s Manual, Volume 1, 3.4.1.1 : General-Purpose Registers in 64-Bit Mode.
<强> 32位操作数产生一个32位结果,零扩展到64位结果在目标通用
注册。
我还要补充,在问候@ HansPassant的评论:7.3.1.7:
I should also add, in regards to @HansPassant's comment: 7.3.1.7 :
的MOVSXD指令64位数据进行操作。它登录一个扩展的32位值64位。
这篇关于零出64位寄存器的高32位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!