-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added Constants.huff and updated Helper.huff
- Loading branch information
1 parent
0c2cbc3
commit bcc16cc
Showing
3 changed files
with
48 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#define constant X1 = 0x2B965CF5968C000 // 1963e14 | ||
#define constant X2 = 0xD9FB2F2E0004000 // 9817e14 | ||
#define constant X3 = 0xDE0B6B3A7640000 // 1e18 | ||
#define constant X4 = 0x9C2007651B2500000 //180e18 |
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,35 @@ | ||
#include './Constants.huff' | ||
|
||
#define macro PUT_C1() = takes(0) returns(1){ | ||
0x04 // [2] | ||
0x2B992DDFA2324A14 //[ 3141592653589793300,4] | ||
sdiv // [3141592653589793300/4] | ||
} | ||
|
||
#define macro PUT_C2() = takes(0) returns(1){ | ||
PUT_C1() //[c1] | ||
0x03 //[3,c1] | ||
mul // [3*c1] | ||
} | ||
|
||
#define macro ABS() = takes(1) returns(1){ | ||
//Input Stack => [x] | ||
0x00 //[0,x] | ||
dup2 //[x,0,x] | ||
slt // [x<0,x] | ||
reverse | ||
jumpi | ||
|
||
reverse: | ||
dup1 //[x,x] | ||
dup1 //[x,x,x] | ||
add //[2x,x] | ||
swap1 //[x,2x] | ||
sub //[-x] | ||
} | ||
|
||
#define macro PUT_X3_CUBE = takes(0) returns(1){ | ||
0x03 //[2] | ||
[X3] //[1e18,3] | ||
exp //[1e54] | ||
} |