forked from z80dev/dasy
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
(defn absoluteValue [] :external | ||
(venom "(seq (mstore (add 32 31) 5945936342127) (mstore 0 20) (return 0 0))")) | ||
(defn storeInMem [] :external | ||
(venom "(seq (mstore (add 32 31) 5945936342127) | ||
(mstore 0 20) | ||
(return 0 0))")) | ||
|
||
(defn retOne [] :uint256 :external | ||
(defvar x :uint256 0) | ||
(venom "(mstore 64 1)") | ||
x) | ||
|
||
|
||
;; 41 gas | ||
(defn addTwoNums [:uint256 x y] :uint256 :external | ||
(defvar z :uint256 0) ;; first variable is at offset 64 | ||
(venom "(mstore 64 (add (calldataload 4) (calldataload 36)))") | ||
z) |
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,11 @@ | ||
@external | ||
def retOne() -> uint256: | ||
x: uint256 = 0 | ||
x = 1 | ||
return x | ||
|
||
|
||
# 71 gas | ||
@external | ||
def addTwoNums(a: uint256, b: uint256) -> uint256: | ||
return a + b |
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