Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does LEA perform signed or unsigned arithmetic?

Tags:

x86

assembly

I'm trying to understand how this line works:

lea (%eax, %eax, 4), %eax

So it looks like this essentially says:

%eax = 5* %eax

But does LEA treat as signed or unsigned?

like image 918
krb686 Avatar asked Aug 13 '26 21:08

krb686


1 Answers

  1. LEA is not really intended to do arithmetic operations but to calculate the absolute address of a memory operation.

  2. There would be no difference between a signed and an unsigned operation; the result for a signed operation and an unsigned operation is the same in this case.

  3. As far as I know there is no possibility to multiply a register with a negative constant using the LEA instruction

like image 84
Martin Rosenau Avatar answered Aug 17 '26 01:08

Martin Rosenau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!