In intel instruction, idiv(integer divsion) means signed division.
I got the result of idiv
, but I don't quite understand the result.
- Example
0xffff0000 idiv 0xffff1100
- My wrong prediction
As long as I know, quotient
should be 0, and remainder
should be 0xffff0000 and because...
0xffff0000 / 0xffff1100 = 0
0xffff0000 % 0xffff1100 = 0xffff0000
- However, the result was...
Before idiv
eax 0xffff0000 # dividend
esi 0xffff1100 # divisor
edx 0x0
After idiv
eax 0xfffeedcc # quotient
edx 0x7400 29696 # remainder
- Question.
The result was value I couldn't expected.
Could someone explain about signed division(idiv
)?
- Appended.
Here's More information about idiv
.
idiv
uses the eax register as a source register.
As a result of execution, quotient is stored at eax, and remainder is stored at edx.