Skip to content

Commit

Permalink
Allow integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerkadDev committed Dec 30, 2023
1 parent 4b2bb1e commit a501778
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 a501778

Please sign in to comment.