Integer: Difference between revisions
m
→Integer Overflow
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 21:
==Integer Overflow==
And I'm sure you've figured it out by now. Yes, if a signed number gets too big, it suddenly becomes very very small. This is known as integer overflow and occurs when a number crosses over from <tt>0x7F...</tt> to <tt>0x80...</tt> (fill in the dots with Fs/0s depending on the size of your numeric data type.) Luckily, nearly all CPUs have special hardware just for detecting overflow, and do so automatically after every calculation. Here's
<lang asm>MOV EAX,0x7FFFFFFF
ADD EAX,1
|