tags:

views:

39

answers:

1

How does overflow work in ia-32?

For instance, what would happen to the following code? What flags would it throw?

movl $0x1, %eax
addl $7fffffff, %eax

Thanks!

+2  A: 

If memory serves, addition sets the overflow flag is set when the sign bit changes without the carry bit being set. 1 + 0x7FFFFFFF would set overflow, clear carry, and clear zero.

Jeffrey Hantin