I noticed that people use: or al, al instead of cmp al, 0.
Is it the same?
Why use or al, al instead of cmp al, 0?
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
Why use or al, al instead of cmp al, 0?
MatÃas Beretta
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
Re: Question
It achieves the same result, but maybe or al, al is faster or takes up less space in the binary.matias_beretta wrote:I noticed that people use: or al, al instead of cmp al, 0.
Is it the same?
EDIT: Well actually they are the same size. So that rules that out. However or eax, eax is 1 byte shorter than cmp eax, 0.
Last edited by frank on Sun Sep 23, 2007 3:50 pm, edited 1 time in total.
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: Question
cmp performs a subtraction and or only a bitwise boolean operation, so it is theorethically slightly faster. But or destroys the value of al.matias_beretta wrote:I noticed that people use: or al, al instead of cmp al, 0.
Is it the same?
- kataklinger
- Member
- Posts: 381
- Joined: Fri Nov 04, 2005 12:00 am
- Location: Serbia
Re: Question
or al,al doesn't change value of al!Craze Frog wrote:But or destroys the value of al.
-
- Member
- Posts: 368
- Joined: Sun Sep 23, 2007 4:52 am
Re: Question
You're right. I forgot the source and destination had the same value...kataklinger wrote:or al,al doesn't change value of al!Craze Frog wrote:But or destroys the value of al.