Skip to content

Commit

Permalink
Merge pull request #328 from PowerkadDev/master
Browse files Browse the repository at this point in the history
Allow integer overflow
  • Loading branch information
auroranil committed Feb 18, 2024
2 parents 4b2bb1e + a501778 commit 2f18c7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions doc/marie.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,11 @@ <h1 class="page-title">Source: marie.js</h1>
}


//this fixes the bug, where the user tries to go beyond HEX-FFFF
if(this[target] > 32767 || this[target] &lt; -32768){
throw new MarieSimError("OverFlow Error","the value " + this[target].toString() + " is beyond the calculable range");
if(this[target] > 32767) {
this[target] -= 65536;
}
else if(this[target] < -32768) {
this[target] += 65536
}


Expand Down
8 changes: 5 additions & 3 deletions src/js/marie.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,11 @@ var MarieSim,
}


//this fixes the bug, where the user tries to go beyond HEX-FFFF
if(this[target] > 32767 || this[target] < -32768){
throw new MarieSimError("OverFlow Error","the value " + this[target].toString() + " is beyond the calculable range");
if(this[target] > 32767) {
this[target] -= 65536;
}
else if(this[target] < -32768) {
this[target] += 65536
}


Expand Down

0 comments on commit 2f18c7e

Please sign in to comment.