Integer overflow: Difference between revisions

Content deleted Content added
→‎{{header|Lua}}: added Lua solution
Puppydrum64 (talk | contribs)
Line 133: Line 133:
=={{header|6502 Assembly}}==
=={{header|6502 Assembly}}==
===8-Bit Overflow===
===8-Bit Overflow===
Signed overflow (crossing the 7F-80 boundary) is detected by the CPU's overflow flag <code>V</code>
Signed overflow (crossing the 7F-80 boundary) is detected by the CPU's overflow flag <code>V</code>.

Unsigned overflow from 255 to 0 is detected by the CPU's carry flag <code>C</code>.
Unsigned overflow (crossing the FF-00 boundary) is detected by the CPU's carry flag <code>C</code>.


The following instructions allow for branching based on the state of these flags:
The following instructions allow for branching based on the state of these flags: