From a50177836e80baa867f8f406e580b1e2fd5bc62f Mon Sep 17 00:00:00 2001
From: powerkad <95581498+PowerkadDev@users.noreply.github.com>
Date: Sat, 30 Dec 2023 10:41:20 -0600
Subject: [PATCH] Allow integer overflow
---
doc/marie.js.html | 8 +++++---
src/js/marie.js | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/doc/marie.js.html b/doc/marie.js.html
index 9b9a3859..8c984b47 100644
--- a/doc/marie.js.html
+++ b/doc/marie.js.html
@@ -426,9 +426,11 @@
Source: marie.js
}
- //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
}
diff --git a/src/js/marie.js b/src/js/marie.js
index 912b4d91..71716299 100644
--- a/src/js/marie.js
+++ b/src/js/marie.js
@@ -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
}