Integer: Difference between revisions

Content added Content deleted
Line 25: Line 25:


The <code>jo</code> instruction stands for "jump if overflow" and acts as a conditional <code>GOTO</code> in the event an overflow occurs.
The <code>jo</code> instruction stands for "jump if overflow" and acts as a conditional <code>GOTO</code> in the event an overflow occurs.
Many high-level languages will do something similar, usually in the form of throwing exceptions. Keep in mind that raising errors on overflow is purely a software convention - the hardware will detect it any time it happens, but the software decides whether the overflow is actually a problem or not. (Overflow, of course, isn't a problem for unsigned integers, so no errors are thrown when they "overflow.")
Many high-level languages will do something similar, usually in the form of throwing exceptions. Keep in mind that raising errors on overflow is purely a software convention - the hardware will detect it any time it happens, but the software decides whether the overflow is actually a problem or not. (Integer overflow, of course, isn't a problem for unsigned integers, so no errors are thrown when they "overflow.")


==Unsigned Overflow==
==Unsigned Overflow==