Skip to content

Commit

Permalink
added RANGE_CHECK function
Browse files Browse the repository at this point in the history
  • Loading branch information
KeneePatel committed May 27, 2024
1 parent c7f578e commit 03b055d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/builtins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const RC_BOUND: bigint = BigInt("340282366920938463463374607431768211456"); // equivalent to 2^128

function RANGE_CHECK(num: bigint): bigint {
if (num < RC_BOUND) {
return num;
} else {
throw new RangeError("provided number was out of range");
}
}
1 change: 0 additions & 1 deletion src/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ function runUntilPc(): void {
runSheet.getRange(`${executionColumn}2`).setValue(FINAL_FP);
runSheet.getRange(`${executionColumn}3`).setValue(FINAL_PC);
while (!(pc === FINAL_PC)) {
console.log(i);
step(i);
i++;
pc = runSheet.getRange(`${pcColumn}${i + 1 + 1}`).getValue();
Expand Down

0 comments on commit 03b055d

Please sign in to comment.