summaryrefslogtreecommitdiff
path: root/src/lopcodes.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-03 08:18:06 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-03 09:03:15 +0100
commit9fbe044cbff12b635e535a36abcf2fb2a03dee11 (patch)
treef78e41199c8b40d50e39e4028de951be1e71c040 /src/lopcodes.js
parent7b844c5caf81ac843a210477ef47fd16e8af2f2c (diff)
downloadfengari-9fbe044cbff12b635e535a36abcf2fb2a03dee11.tar.gz
fengari-9fbe044cbff12b635e535a36abcf2fb2a03dee11.tar.bz2
fengari-9fbe044cbff12b635e535a36abcf2fb2a03dee11.zip
Dispatch loop
Diffstat (limited to 'src/lopcodes.js')
-rw-r--r--src/lopcodes.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lopcodes.js b/src/lopcodes.js
index b7dfb0f..8df67a3 100644
--- a/src/lopcodes.js
+++ b/src/lopcodes.js
@@ -86,6 +86,16 @@ const MAXARG_A = ((1 << SIZE_A) - 1);
const MAXARG_B = ((1 << SIZE_B) - 1);
const MAXARG_C = ((1 << SIZE_C) - 1);
+const BITRK = (1 << (SIZE_B - 1));
+
+const ISK = function (x) {
+ return x & BITRK;
+};
+
+const INDEXK = function (r) {
+ return r & ~BITRK;
+}
+
module.exports = {
OpCodes: OpCodes,
SIZE_C: SIZE_C,
@@ -105,5 +115,8 @@ module.exports = {
MAXARG_Ax: MAXARG_Ax,
MAXARG_A: MAXARG_A,
MAXARG_B: MAXARG_B,
- MAXARG_C: MAXARG_C
+ MAXARG_C: MAXARG_C,
+ BITRK: BITRK,
+ ISK: ISK,
+ INDEXK: INDEXK
}; \ No newline at end of file