XOR寄存器,寄存器(汇编) [英] XOR register,register (assembler)

查看:158
本文介绍了XOR寄存器,寄存器(汇编)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不时我们来分​​析汇编code片(IA32)
比通常更我碰到过,看起来像这样的指令:

From time to time we have to analyze pieces of assembler code (IA32), and more than often i come across an instruction that looks like this:

xor ax, ax

或其它寄存器藏汉: XOR DX,DX 异人,人 ...

or with other registers aswell: xor dx, dx, xor al, al, ...

这究竟做什么? (斧斧异总是给人0?)

What exactly does this do ? (ax xor ax always gives 0 ?)

推荐答案

这是一个常见成语汇编到寄存器设置为0。

It's a common assembler idiom to set a register to 0.

异斧,斧对应 AX = AX ^ AX 其中,因为你已经通知,实际上是 AX = 0

xor ax, ax corresponds to ax = ax ^ ax which, as you already notices, is effectively ax = 0.

如果我没有记错的主要优点是,它的code尺寸比 MOV AX,0

If I recall correctly the main advantage is that its code-size is smaller than mov ax, 0

这篇关于XOR寄存器,寄存器(汇编)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆