-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove support for the ">>>" operator This operator is the unsigned right shift operator, which is not supported in mlog * use bigints to perform constant bitwise operations this is done to prevent data losses caused by javascript using 32-bit integers to perform bitwise operations while mlog uses 64-bit integers for that * use number values for all operators except "+" This makes the constant expression evaluation more consistent with the mlog environment, since the input values there are always converted to numbers first. However, constant string concatenation via the + operator is still allowed in order to not break existing mlogjs scripts * add a test for constant bitwise operations * update the changelog
- Loading branch information
Showing
5 changed files
with
63 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// makes sure that the compiler evaluates constant bitwise | ||
// operations using 64-bit integers to have parity with | ||
// the mlog runtime | ||
|
||
// integer outside the limits of 32-bit integers | ||
const value = 2 ** 33; | ||
|
||
print(value >> 30, "\n"); // expected: 8 | ||
print(value | 0, "\n"); // should not lose precision | ||
print(value ^ (2 ** 32), "\n"); | ||
print(value << 1, "\n"); | ||
printFlush(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
print 8 | ||
print "\n" | ||
print 8589934592 | ||
print "\n" | ||
print 12884901888 | ||
print "\n" | ||
print 17179869184 | ||
print "\n" | ||
printflush message1 |