I keep getting a integer overflow problem and i have no idea how to solve it can anyone help? edx conatins 181 and eax contains 174
xor eax,edx
mov edx,2
div edx
Assuming you're talking about x86, div edx
doesn't really make sense -- a 32-bit div divides edx:eax by the specified target register. Fortunately, to divide by 2, you don't really need to use div
at all.
mov eax, 174
mov edx, 181
xor eax, edx
shr eax, 1
If you do insist on using a div
for some reason, you want to use a different register. Note that the x86 expects the result of the division to fit in one register, so you'll need to zero edx before the division:
mov eax, 174
mov edx, 181
xor eax, edx
xor edx, edx
mov ebx, 2
div ebx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With